Syntactical sugar for string templates and lambdas?
via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 26 04:32:56 PDT 2014
On Tuesday, 26 August 2014 at 10:10:07 UTC, Ola Fosheim Grøstad
wrote:
> I have spent some time thinking about how the D syntax can be
> polished by adding sugar. I wonder if this would be possible to
> implement in the parser:
>
>
> IN:
> (int`x + int`y) * `y
>
> OUT:
> (int __1,int __2) => (__1 + __2) * __2
>
>
> IN:
> callTemplate!(`mycmp`(`a,1+2))
>
> OUT:
> calltemplate!("mycmp(a," ~ __to_string( 1+2 ) ~ ")")
Apart from the fact that I find this harder to read than simply
spelling it out: Backticks are already used for wysiwyg strings.
It's almost impossible to reuse them for anything else.
More information about the Digitalmars-d
mailing list