foo => "bar" key/value literals in D!
Jacob Carlborg via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Wed May 25 04:22:41 PDT 2016
On 2016-05-25 11:24, 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)
>
> Currently I just copy/paste the fix to ParameterIdentifierTuple
> everywhere as the needed primitives already exist.
>
> Removing the already existing primitives now is imho too late, as it
> breaks code, which sometimes is OK, but this time there's no clear
> solution how to rewrite the broken code.
>
> Unfinished Library based Named-parameters proof-of-concept:
> (yes, I know. It needs to be updated to handle case [2])
> https://dpaste.dzfl.pl/ae55de677f86
>
> /vote open floodgates for introspection, capitalizing on the strengths
> of D.
I don't think this is the right approach. I think the correct approach
is to allow introspection of template parameters [1]. That would allow
to get the parameter names without having to instantiate the template.
ParameterIdentifierTuple can hopefully be updated to take advantage of
this feature when it's available in compiler without requiring to change
the API of ParameterIdentifierTuple.
[1] https://github.com/dlang/dmd/pull/5201
--
/Jacob Carlborg
More information about the Digitalmars-d-announce
mailing list