foo => "bar" key/value literals in D!
    Adam D. Ruppe via Digitalmars-d-announce 
    digitalmars-d-announce at puremagic.com
       
    Wed May 25 05:29:55 PDT 2016
    
    
  
On Wednesday, 25 May 2016 at 09:24:31 UTC, Daniel N wrote:
> From an end-user perspective I find it reasonable to expect 
> that an API which takes lambda:s works consistently for both 
> below examples. i.e. if we support one we should support the 
> other.
>
> [1] fun!(     x  => y)
> [2] fun!((int x) => y)
Those are indeed both can work to fetch names, though they aren't 
exactly the same since the first one is a template and the second 
one isn't. The technique is slightly different right now, but 
both doable (and I have no objection to unifying the techniques)
The big difference I'm talking about is passing them as an alias 
argument vs as a runtime argument. Runtime function pointers lose 
many of the introspection capabilities of compile time alias 
arguments (well, runtime args still can pretend to give you 
names, but you'll find it doesn't actually work very well).
 From the looks of the Phobos PR too, it looks like some of the 
commentators conflated the two issues too: template vs 
non-template isn't the same as alias vs delegate.
    
    
More information about the Digitalmars-d-announce
mailing list