[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
import/include philosophical Was: Problem with my first app
From: |
Pascal Bourguignon |
Subject: |
import/include philosophical Was: Problem with my first app |
Date: |
Sun, 14 Oct 2001 20:20:12 +0200 (CEST) |
> Date: Sun, 14 Oct 2001 16:25:40 +0100
> From: Richard Frith-Macdonald <richard@brainstorm.co.uk>
[...]
> > - ObjC headers should be #imported, not #included
>
> Actually the second point is a matter of taste ...
> use of #import is in fact deprecated by the compiler.
> The rationale I read for it being deprecated is that the
> use of protective #ifndef and #defines in the headers is
> preferred because it makes the way the header is meant to
> be used explicit.
That, if you want to keep the low-level mindset of the C preprocessors
and C compilers 30 years old.
Remember that the C preprocessor exists only to paliate the defects of
the C language.
Any high-level language can do without it because it has the semantics
needed to deal with the stuff dealt with by the C preprocessor. Have a
look at Modula-2, Modula-3, ADA, etc.
Since Objective-C wanted to add a higher level layer over C, it's
natural that it introduces a higher level way to import the interface
of a module.
When 100% of the "headers" contains that #ifndef/#define, it's
revealing that the semantics of #include are not adapted to nowaday
usage.
Perhaps, it's unfortunate that Objective-C still called the interface
files ".h". It would have been better if they were called ".mi" or
anything different than ".h". After all, they're not "headers" they're
"interfaces", if you can see the difference.
Similar problem exists with C++. Personally, I name my C++ interface
files with ".hh" (C++ class files being named ".cc"). While a C++ or
Objective-C source can import a C "header", no C source can use a
Objective-C or C++ interface, therefore I think that the different
extension for interfaces is justified. Too bad that cc on NeXTSTEP
were actually an Objective-C compiler, not a C compiler.
In my opinion, what should be deprecated is not #import, but #include.
--
__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------
- Problem with my first app, PERON Stéphane, 2001/10/13
- Re: Problem with my first app, Jeff Teunissen, 2001/10/13
- Re: Problem with my first app, Pascal Bourguignon, 2001/10/13
- Re: Problem with my first app, Philippe C.D. Robert, 2001/10/14
- Re: Problem with my first app, Richard Frith-Macdonald, 2001/10/14
- import/include philosophical Was: Problem with my first app,
Pascal Bourguignon <=
- Re: Problem with my first app, Philippe C.D. Robert, 2001/10/14
- Re: Problem with my first app, Pascal Bourguignon, 2001/10/14
- Re: Problem with my first app, Nicola Pero, 2001/10/14
- Re: Problem with my first app, Nicola Pero, 2001/10/14
- Re: Problem with my first app, Philippe C.D. Robert, 2001/10/14
Re: Problem with my first app, Nicola Pero, 2001/10/13
Re: Problem with my first app, Pascal Bourguignon, 2001/10/13