discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: #import is obsolete


From: Nicola Pero
Subject: Re: #import is obsolete
Date: Mon, 7 Jul 2003 10:36:05 +0100 (BST)

> > #import is deprecated, instead #include should be used in conjunction 
> > with include guards. See previous threads about this topic.
> 
> The #import directive is *not* deprecated in Objective-C and you should 
> *not* switch to #include with include guards;

Of course you should switch to #include with include guards! :-)

#import is deprecated in the FSF GCC compiler - the warning you see is 
produced by the GCC compiler itself.

We used to hide that warning thinking (as you do) that it was mostly a
"religious but harmless" warning, but from recent discussions / talks of
the FSF GCC maintainers, we know that the party against #import has grown
much and much stronger (with people from inside Apple silently or
not-so-silently supporting it), and that #import is very likely to be
removed in next versions of the FSF GCC compiler.

The best we (GNUstep) can do is try to make sure this information reaches
all our users, and that they have time to update their code before the
change happens, and are not taken by surprise when/if an FSF GCC without
support for #import is shipped.  This is why the warning is now visible to
all users.  You can ignore it if you want, but it's better to give it a
few thoughts.


The main reason they want to remove #import is that it is badly defined -
its semantics is unclear, and all efforts to make it clearer end up with
"definitions" which are very hard (or impossible) to implement portably
and efficiently.  For technical reasons (see discussions on the GCC
mailing list) #import and precompiled headers are particularly hard to be
made to work at the same time portably on a vast range of platforms.  The
addition of precompiled headers to FSF GCC is the main reason why this
issue of #import has been considered once again.

Generally, it is felt that efficient and portable precompiled headers, and
generally efficient and portable header parsing, are a much more important
feature than #import.  It's hard to disagree on this point.

My personal point of view is that I'd prefer a simple language where the
additions to C are limited to the bare minimum necessary, because that
makes it easier to implement an Objective-C compiler, or to maintain the
existing Objective-C GCC compiler working.  This can be very important for
the long term survival of the language; I'd like GNUstep to be able to
survive even if Apple disappears (or changes market strategy and discards
Objective-C), and in that respect it's better if the key components of the
system (such as the Objective-C compiler) are easy to maintain.  Removal
of #import looks like a very welcome simplification to me; it doesn't
change anything in the language, it makes it much better defined, and
removes a very hard part of implementing it, making all our future efforts
of keeping and expanding and porting Objective-C easier.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]