Re: usage of #import?
Re: usage of #import?
- Subject: Re: usage of #import?
- From: Don Yacktman <email@hidden>
- Date: Sat, 2 Nov 2002 13:03:22 -0700
On Saturday, November 2, 2002, at 12:13 PM, Philippe C.D. Robert wrote:
the official advice/message/rule from the gcc folks is not to use
"#import" anymore at all. Although it still works with gcc 3.x it is
considered as deprecated (see -Wno-import).
Now Apple is still using #import in 10.2 thus I wonder what Apple's
position is in this respect? What should be used by 3rd party
developers for custom ObjC code? How will Apple deal with this in the
future?
Can anyone from Apple explain or comment the official position.
I'm not an Apple official source, but I know the history of this having
been around since the NeXT days...
Basically, #import has been "deprecated" since the moment Objective-C
was added to gcc because Stallman doesn't like it. (His rant about
#import is one of the most luddite things I've ever read.) NeXT and now
Apple have both continued to use it and, if history is followed
consistently, will continue to use it whether or not Stallman likes it.
End of story.
That "deprecation" has literally been a part of GCC for well over a
decade! And every few years, some poor soul spots it and wonders what
the hell is going on. It's not exactly a FAQ, but it's definitely one
of the bizarre insanities that the NeXT community just got used to...
More background and my personal ranting, with a little reason thrown in:
Many consider Brad Cox's book on Objective-C to be a definitive work on
what is required to make a language be Objective-C. You could argue it
is, since he did invent Objective-C after all. But NeXT, and now
through acquision, Apple owns the trademark on the language's name.
NeXT added a few extensions to the language that I consider invaluable,
so I think Cox's book is only a bare minimum, really. And according to
Cox, the #import directive is an integral part of Objective-C, one of
the few additions to the C language to turn C into Objective-C. So by
any reasonable measure, #import is a part of the Objective-C language,
as defined by the people with the right to decide what is or isn't
Objective-C.
While Stallman can deprecate #import all he wants, I intend to keep
using it. Stallman has no place telling the world what can or can't be
part of a language he didn't invent and he doesn't control. Hell, he
can't really even say that the compiler is "his" at this point; it's got
a life of its own. That's the nature of large open source projects --
they outgrow their creator(s). Without an ANSI standard for
Objective-C, the body that holds the Objective-C trademark decides what
is or isn't Objective-C. That body is Apple, not Stallman.
Now he has his reasons for not liking #import. Frankly, I disagree with
him. I like it, because I hate having to pollute headers with guards.
I think they're ugly and the compiler should be smart enough to only
pull things in once so that I don't need to add that cruft to every
freaking header. Yes, there are cases when you want to bring things in
multiple times, but they are rare. Let the developer override those
explicitly since they are the exception, not the norm. The normal case
is what #import handles, and allows you to stick to writing code, as
opposed to wasting time adding header guards. So I think Stallman is
being / has been an ass about the #import directive.
But really, it boils down to a "religious" argument as to whether or not
#import has any merit. Stallman's main arguement against it really just
boils down to "it doesn't please me aesthetically and as long as I can
force my vision upon others, I'll try to". Regardless, I and many
others think #import does have merit.
However, religious argument or not, Stallman has no place telling people
what can or can't be in Objective-C. #import is a part of Objective-C
unless and until Apple officially decides it isn't. Considering how
much source code would be broken by such a change -- millions upon
millions of lines -- I seriously doubt Apple will change the definition
of the Objective-C language to suit Stallman.
So feel free to use #import all you want. And, if it makes you happy,
flip a virtual bird at Stallman every time you do.
--
Later,
Don Yacktman
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.