Hello Yigal,

On 20/12/2009 03:11, BCS wrote:

I don't know how it does it but there has to be more to it in C#
because they allow you to do thing to the objects that Object doesn't
support. For that to happen, the objects have to be wrapped or tagged
or something so that the generics code can make "foo.MyFunction()"
work for different types. If I has to guess, I'd guess it's done via
a vtable either as a "magic" interface or as a fat pointer.

Oh, and if the above is garbage because C# can't access totally
independent methods from a generic, then right there is my next
argument against generics.


[reordered a bit]

This is orthogonal to generics. the limitations you see in C# are
*not* limitations of its generics but rather of the meta-programing
facilities.


I that case, I don't give a rat's A** about generics. Do whatever you want as long as you don't mess with my meta-programming stuff.

What you're talking about in the above is meta-programing. Doing
meta-programing a-la c++ templates is IMO like trying to use square
wheels, it is just wrong.

To answer your questions:
D already has better designed tools for this and they keep improving.
Don is doing an excellent job in fixing CTFE.
I think D needs to go beyond just constant-folding (CTFE) and allow to
run any function at compile-time in the same manner it's done in
Nemerle
(multi-stage compilation).

Personally I see CTFE as a hack for about half of the use cases I'm interested in. The vast bulk of the meta-programming that I care about amounts to compile time code generation. For that, CTFE falls into one of two uses; data processing to convert user input into something that can be (somehow) converted into code and mixin(CTFE()).

For the first I think we are in agreement, the more CTFE can do the better. For the second, I think it's a total abomination in all but a few tiny use cases.

Reply via email to