Re: C question for you old guys ;-)
Re: C question for you old guys ;-)
- Subject: Re: C question for you old guys ;-)
- From: Andy Lee <email@hidden>
- Date: Wed, 11 Jun 2003 12:14:54 -0400
At 5:29 PM +0200 6/11/03, Jay Vaughan wrote:
If one is worried about changing language semantics, let's start by
not changing the semantics of "semantics."
The word 'semantics' means 'The study of relationships between signs
and symbols and what they represent'.
Unless declared otherwise, standardly as a variable declaration or
with the ever popular cocoa-nutcase "#define is ==" macro, the
symbol 'is' means _nothing_ to the compiler.
Right. "Unless declared otherwise."
Making 'is' = '==' when normally 'is' means *nothing* to the
compiler, is, in fact, modifying the compilers/preprocessors
semantics.
Nonsense. It is *using* the semantics of #define. The only way to
modify the compiler's semantics is to modify the compiler itself.
You could argue that #define in general is evil -- and in fact, one
benefit of the const keyword is that it can be used in many cases
where an old C programmer would have used #defines. But if you
wanted to remove the #define directive from C, then *you* would be
changing the semantics of the language (or rather, the preprocessor)
by causing a special symbol ("#define") to lose its meaning.
In this case 'is' isn't a variable, its a new 'compiler symbol',
semantically used where '==' used to be.
It's not a new compiler symbol, and putting quotes around 'compiler
symbol' doesn't make it so. The only way to add a compiler symbol is
by modifying the compiler.
By definition, every #define'd symbol is used where the thing it
replaces used to be. (I'm not sure what "semantically" used means --
as opposed to unsemantically used?) As you know, the semantics of
#define clearly doesn't treat any particular type of substitution as
a special case. It is a purely textual substitution.
--Andy
_______________________________________________
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.