foo => "bar" key/value literals in D!

Adam D. Ruppe via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon May 23 18:33:40 PDT 2016


On Monday, 23 May 2016 at 20:08:11 UTC, Daniel N wrote:
> This pull request just removes an intentional restriction and 
> make this feature more easily accessible for meta-programming, 
> so that not everyone has to reinvent the wheel in their own 
> libraries.

Soooo I'm actually not entirely convinced on that change. 
Parameter names should *not* be part of a function pointer or 
delegate type - that's not supported and kinda randomly buggy to 
depend on (if the types match, the names might not: the compiler 
is free to reuse the structure for matching types which means the 
names you get might be the ones from a previous definition!)

Alias arguments are IMO different though, because they aren't a 
function pointer/delegate type, they are actually a function 
symbol, just one that happens to be defined inline. They should 
work.

But I think the restriction on delegates' parameter names is 
actually a good one, protecting you from bugs in more complex 
programs.


More information about the Digitalmars-d-announce mailing list