DIP 1027---String Interpolation---Community Review Round 1

Steven Schveighoffer schveiguy at gmail.com
Tue Dec 17 18:43:09 UTC 2019

On 12/17/19 1:17 PM, Meta wrote:
> On Tuesday, 17 December 2019 at 17:31:05 UTC, Steven Schveighoffer wrote:
>> This works pretty well, shows the filename/line numbers, and 
>> reevaluates the log message each time.
>> Another cool use case.
> This got me excited, but unfortunately it doesn't work with expressions 
> (for obvious reasons):
> // Error: variable apples cannot be read at compile time
> alias msg = AliasSeq!("%s apples and %s bananas makes %s fruit", apples, 
> bananas, apples + bananas);

Right, the alias has to be a symbol or a constant. Though you could 
technically put in a lambda. I don't know if the log/writef would 
support that.

This doesn't mean it's not useful if it can only be a symbol, I predict 
even without string interpolation, my printf debugging that I generally 
use is going to be enhanced with this idea.


More information about the Digitalmars-d mailing list