Use cases for alias parameters

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Nov 13 13:01:41 PST 2007


"Jari-Matti Mäkelä" <jmjmak at utu.fi.invalid> wrote in message 
news:fhd1pm$dke$1 at digitalmars.com...

> Since alias accepts only explicitly defined symbols and for some unknown
> reason delegate literals, I thought this was a hidden macro system :) It
> could possibly inline the delegate but it doesn't currently :| Also there
> are interesting places where alias parameters could be used, e.g. operator
> overloadings (to avoid extra parameter passing). Extending these could
> eliminate many cases where you need to use ugly CTFE&mixin trick.

This works because a delegate literal is really a reference to an 
implicitly-defined nested function.  So you're passing an alias to an 
automatically-generated symbol name.  It works with function literals too:

foo!(function void(){ chicken(); }); 





More information about the Digitalmars-d mailing list