Implicit enum conversions are a stupid PITA

bearophile bearophileHUGS at lycos.com
Fri Mar 26 12:58:31 PDT 2010


Andrei Alexandrescu:

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

It's hard to write such things, you have to be an expert C# programmer (you have to write C# code that operates on the AST or the language of the virtual machine). I have asked but I am not good enough to do that, sorry. Metaprogramming is not easy in most languages that allow some of it :-)


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

You are right, I can't know.

Note: user-defined attributes and mixins have different purposes. User-defined attributes are much fitter than mixins if you want to add something simple to the type system.
I have found an introduction on C# attributes, but it doesn't show actions on the AST/IL:
http://www.codeproject.com/KB/cs/attributes.aspx?display=Print


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

Here D template syntax is better, you are right.

Bye,
bearophile



More information about the Digitalmars-d mailing list