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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Feb 13 08:44:24 PST 2012


On 2/13/12 7:46 AM, David Nadlinger wrote:
> On 2/13/12 2:43 PM, Andrej Mitrovic wrote:
>> auto u = (a, b) => cast(ubyte)uniform(a, b);
>>
>> Which would make 'u' a template. I'm not sure what the exact syntax
>> was that was requested though.
>
> This could never work without major changes to the language, because 'u'
> cannot be assigned a type.
>
> David

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

should work. This makes is a case where the discussed syntax "alias 
defined = definee;" would be helpful.

Andrei


More information about the Digitalmars-d mailing list