Implicit enum conversions are a stupid PITA

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 25 10:18:57 PDT 2010


On 03/24/2010 07:34 PM, bearophile wrote:
> Andrei:
>
>> Nick Sabalausky:
>>> He was modifying the common expression "Those who don't learn from the past
>>> are doomed to repeat it."
>>
>> But paraphrasing ain't "as they say" because they don't say that.
>> Besides, I thought he's paraphrasing "Any sufficiently complicated C or
>> Fortran program contains a buggy implementation of Common Lisp." But I
>> guess that's just me being cranky - I'm sick.
>
> Nick was right.
> Sorry for upsetting you, I am sorry.

I missed this. There's no need for anything close to that. We all could 
get "upset" regarding a post or a notion, not against the person airing it.

As far as the matter at hand of that thread is concerned, you mentioned 
the possibility:

alias Flags!(ubyte, "do_nothing",
                     "walk_dog"
                     "cook_breakfast"
                     "deliver_newspaper"
                     "visit_miss_kerbopple"
                     "wash_covers") Todo;

I encourage you to code that up and see how it swims. We need to stop 
inventing syntax for any single thing that seems useful, and start 
eating our dogfood. If our mechanism for code generation is not good 
enough, we should improve it, not generate by hand ever new constructs.

That reminds me of my late night conversation with Walter of yesterday. 
I'm sure he wouldn't mind me posting it. Summarized, it's as follows:

A: I'm revising the copyedited manuscript for TDPL. This is the last 
chance to remove octal literals!!!

W: I know everybody hates them, but I like them.

A: Use octal!"177"

W: Ugh.

A (esprit d'escalier): If you don't like the universal notation you 
invented, who will?

Since there's always something useful coming up, we need to figure out 
how our code generation abilities step up to the plate. I will add octal 
to Phobos, and if it is problematic then probably we need to adjust 
template syntax. My opinion in the matter is that there may be at most a 
handful of octal constants total in anyone's codebase, so having a 
cleverer syntax for them ain't going to make any difference.


Andrei



More information about the Digitalmars-d mailing list