Conditional compilation inside asm and enum declarations
Bill Baxter
wbaxter at gmail.com
Tue Jul 14 15:32:42 PDT 2009
On Tue, Jul 14, 2009 at 2:52 PM, Walter
Bright<newshound1 at digitalmars.com> wrote:
> Leandro Lucarella wrote:
>>
>> 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 ...).
>
> It's not about protecting idiots. It's about making the better way to do
> things the easier and more natural way, and making the worse more difficult.
>
> In C++,
>
> int a[5];
>
> is the wrong way, and:
>
> std::vector<int>(5) a;
>
> is the right way. C++ makes the right way ugly and hard. I'd like to reverse
> that.
>
> All languages have some characteristics of "you shouldn't be allowed to do
> that", the problem is where the line is drawn.
>
> I have long, long experience with #ifdef's. I know how convenient it is to
> just plop those things in, like your first hit of heroin. I know how
> justifiable just that one little old #ifdef is. Then you add in another, and
> another, and another, and another, and eventually wonder how you wound up
> with such an impenetrable thicket of awfulness. My own code gets like that
> (despite my knowing better) and just about every long lived piece of
> C/C++/asm code I've run across.
You do realize you're being patronizing, right? "I have so much
experience with these things, and I know the right way to write code,
and you don't, so I'm not going to give you this thing you request
because it's not good for you".
Also note that despite D's limitations supposedly making things
better, you just got through describing how parts of Phobos turned
into a mess anyway.
So not only do the little missing capabilities annoy people who would
use them judiciously, they also apparently don't have the desired
outcome of eliminating poor use of conditional compilation. Sounds
like something you would find in a patronizing nanny-language to me.
Which is odd, because D isn't like that, overall.
--bb
More information about the Digitalmars-d
mailing list