The One-Letter Nested Function - a sample article for some kind of D "gems" website

Nick Treleaven nospam at
Mon Feb 13 07:36:00 PST 2012

On 13/02/2012 14:21, Andrej Mitrovic wrote:
> On 2/13/12, David Nadlinger<see at>  wrote:
>> This could never work without major changes to the language, because 'u'
>> cannot be assigned a type.
> Yeah, the syntax is wrong. I found bear's post and the syntax:
> alias (x =>  x ^^ 2) sqrTemplate;
> So it would be:
> alias ((a, b) =>  cast(ubyte)uniform(a, b)) u;

Here 'alias name = expression' syntax helps shed brackets:

alias u = (a, b) => cast(ubyte)uniform(a, b);

That looks nice IMO.

More information about the Digitalmars-d mailing list