Implicit enum conversions are a stupid PITA

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Mar 25 12:03:22 PDT 2010


On 03/25/2010 01:33 PM, bearophile wrote:
> 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.

I believe you're exaggerating.

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

Could you please paste C# code doing that here? Then we have a good 
baseline to compare the D implementation with.

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

Why and how do you believe that whatever mechanism we come up with 
(possibly following a proposal authored by you) will be a net 
improvement over mixins?

>> and if it is problematic then probably we need to adjust template
>> syntax.<
>
> What kind of changes are you thinking of?

Whatever doesn't give you nausea.

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

auto someVariable = "1234"_Octal;

Doesn't look like a day and night to me compared to

auto someVariable = octal!"1234";

Are you sure you are saying what you mean to say?


Andrei



More information about the Digitalmars-d mailing list