discuss-gnustep
[Top][All Lists]
Advanced

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

Re: [OT] Re: import


From: Pascal Bourguignon
Subject: Re: [OT] Re: import
Date: Sat, 22 Dec 2001 01:47:02 +0100 (CET)

Stan Shebs <shebs@apple.com> wrote:
> 
> Pascal Bourguignon wrote:
> > 
> > The #import  CPP directive is defined  as including a  given file once
> > ever in a  compilation run, and that's enough to  be an improvement to
> > #include.
> 
> You're casually assuming that "a given file" is a well-defined
> concept.  In the presence of symlinks, relative paths, and multiple
> -I directives on the command line, that's just not true.  In fact,
> correct implementation of #import requires looking at inodes to
> verify identity, which is not portable because inodes are a Unix
> thing.  (I have a patch in Apple's GCC that does this for some
> pathological cases that occur in OS X code, needs to be cleaned
> up for FSF submission still.)
> 
> I think what happened with #import is that it was originally intended
> to be a genuine interface-loading construct, but somewhere along the
> way it got turned into an intelligent #include.  #import <classname>
> wouldn't have the file identity issue of #import <filename>, because
> there is only one global space of classes, and behind the scenes you
> could have a database of classes for the compiler to look in.  Alas,
> although everybody pays lip service to the idea that each #imported
> .h corresponds exactly to a single class interface, in practice lots
> of non-class bits get slipped in, and so we're back to being just a
> dialect of C, with #import being like #include, but flakier.
> 
> Stan

Well, I'm  beginning to  believe that it's  true that #import  is bad,
while all  the other import clauses  in the other  languages are good,
just because once more, it was badly done in CPP/C...

What  would have  been needed  to avoid  symlinks, relative  paths and
multiples -I directives being a  problem, like in other language, is a
"@import CLASSNAME;" directive (note the @).

But clearly we're far from it in the C family of languages...


On the other hand, I never had any problem using #import, working with
projects up to ~500 classes  and 4 developers.  Who did?  Aren't those
problems just theorical?

-- 
__Pascal_Bourguignon__              (o_ Software patents are endangering
()  ASCII ribbon against html email //\ the computer industry all around
/\  and Microsoft attachments.      V_/ the world http://lpf.ai.mit.edu/
1962:DO20I=1.100  2001:my($f)=`fortune`;  http://petition.eurolinux.org/

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d? s++:++(+++)>++ a C+++  UB+++L++++$S+X++++>$ P- L+++ E++ W++
N++ o-- K- w------ O- M++$ V PS+E++ Y++ PGP++ t+ 5? X+ R !tv b++(+)
DI+++ D++ G++ e+++ h+(++) r? y---? UF++++
------END GEEK CODE BLOCK------



reply via email to

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