Implicit enum conversions are a stupid PITA

Nick Sabalausky a at a.a
Wed Mar 24 10:57:57 PDT 2010


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:hod5o3$1nhg$1 at digitalmars.com...
> On 03/24/2010 08:28 AM, bearophile wrote:
>> As
>> they say: "Those who cannot learn from C# are doomed to re-invent it,
>> often badly."
>
> Who are "they"?
>

He was modifying the common expression "Those who don't learn from the past 
are doomed to repeat it."

>> (In D you can solve this problem creating a flags struct, using a
>> strategy similar to the one used by std.bitmanip.bitfields, but it
>> feels hackish).
>
> Why does a mechanism that allows creating bitfields, custom enums, flags, 
> custom-base literals, and more, feel hackish,

Because it involves passing everything as parameters to a 
string-mixin-generating function/template. Powerful as such as thing is, and 
as much as I like having that ability available, it is a rather blunt 
instrument and does tend to feel very hackish.

Also, looking at the docs for bitmanip, it looks like "bitfields" creates a 
"BitArray". But the interface for bitarray doesn't really seem to match the 
conceptual-level operations performed on bitfields any more than just using 
an ordinary uint would, and it doesn't seem to solve most of the problems 
with doing so, either.

> whereas dumping a wheelbarrow of narrow-usefulness features with every 
> release

Custom bitfields are extremely useful for low-level code. Being a 
self-proclaimed "systems" language, there's no reason D should consider such 
a thing to be of "narrow-usefulness".

> while still failing to address major problems (concurrency, immutability) 
> feels not?
>

I don't think anyone's suggesting that things like concurrency and 
immutability should fail to be addressed.





More information about the Digitalmars-d mailing list