Implicit enum conversions are a stupid PITA

bearophile bearophileHUGS at lycos.com
Thu Mar 25 11:33:28 PDT 2010


Andrei Alexandrescu:

>I encourage you to code that up and see how it swims.<

The idea of using that syntax gives me nausea, I can't use that even if I implement that myself.


>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.<

In C# there are ways to define your own properties, so you can possibly use C# to define something like that @fields. This is an example of a general tool that can be used to meta-program, keeping the C# compiler unchanged (I am not proposing to add this to D2, but user-defined attributes can be OK in D3. They can be a partial alternative to macros too).


>and if it is problematic then probably we need to adjust template syntax.<

What kind of changes are you thinking of?


Regarding octals (and multi-precision integer literals, and unit system suffixes), it seems C++0x has user-defined literals :-)
http://en.wikipedia.org/wiki/C++0x#User-defined_literals
(I am not asking to solve the D octal problem with them.)

Bye,
bearophile



More information about the Digitalmars-d mailing list