Conditional compilation inside asm and enum declarations
Leandro Lucarella
llucax at gmail.com
Tue Jul 14 14:14:37 PDT 2009
Walter Bright, el 14 de julio a las 10:01 me escribiste:
> Bill Baxter wrote:
> >But from where I sit it looked like Walter didn't really convince
> >anyone. To me this seems like a point where D is overly patronizing,
> >to use the phrase from a recent post.
>
> You could argue that, but it also took a long time to convince many about the
> merit of const and immutable. I understand that C style versioning is so
> seductive, it's very hard to see what's wrong with it.
>
> (For another reason against such, I could send you some of the source to
> optlink. It's chock full of line by line versioning, nested versioning,
> a couple dozen version arguments, it's so bad the only way I can tell
> what's going on is to compile it then *disassemble* it to see what the
> code actually is.)
>
> Contrast that with the dmd front end source where I've made a concerted effort
> (not 100% yet) to remove #ifdef's.
>
> And I didn't even touch on what would have to happen if versioning could slice
> anywhere - it would have to be done as a separate pre-pass. It couldn't be
> integrated in to the current one-pass parser, and would do a fine job of
> screwing up syntax highlighters and pretty-printers much like C's preprocessor
> can.
I have to debug somebody else code right now and in the name of
portability is written in some kind of pseudo-language in C macros. The
result is the as optlink, you have to pre-process the source to actually
know what it's doing.
But I think this is not because C is bad, this is because the people who
wrote that code are animals, and I think the language shouldn't get in the
way if you want to use it, we all are consenting adults =). I clearly
agree with Walter that the right thing to do is separate OS-dependant
functionality in different modules, and I think the D standard library
should do that as an example of how things should be done in D (showing as
a living example that that's the way to go).
The same goes for version (!X) ..., I think it should be available, there
are cases when the use is valid and you have to do artificial hacks like
version (X) else .... It's like Java not having functions or global
variable. You're just annoying people that know what they're doing to
"protect" the idiots (which can go and use static methods and variables
anyways; or version (X) else ...).
I completely agree with Bill, that's patronizing...
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Un camión lleno de amigos, míos.
Cada uno dando vueltas, en su cabeza.
Mientras yo, sufro la picadura de mi propia abeja.
More information about the Digitalmars-d
mailing list