string interpolation fun

Steven Schveighoffer schveiguy at gmail.com
Thu Dec 13 16:31:06 UTC 2018


On 12/13/18 11:29 AM, Steven Schveighoffer wrote:
> On 12/13/18 11:21 AM, Jonathan Marler wrote:
> 
>> Adding support for the `$foo` case (no parens) would be fairly trival, 
>> but requires making a decision of what type of grammar node/token to 
>> use.  We could use the same mechanism that templates use, but that 
>> would mean that something like $foo.max would be $(foo).max instead of 
>> $(foo.max) which seems a bit unexpected.  That would be a good thing 
>> include in the DIP, a list of the obvious tokens/grammar nodes we 
>> could use and their pros/cons.
> 
> Yeah, I would recommend $foo.max be $(foo.max). This isn't like 
> templates, where the dot is meaningful both ways.

I'd say it's more like the address operator:

&foo.member means &(foo.member), not &(foo).member

-Steve


More information about the Digitalmars-d mailing list