interpolation proposals and safety

Steven Schveighoffer schveiguy at gmail.com
Thu Aug 29 14:21:24 UTC 2024


On Thursday, 22 August 2024 at 19:34:32 UTC, kdevel wrote:
> `writeln` should not print unadorned interpolated string 
> expressions.

I find this argument unconvincing.

You can print anything with `writeln`. Even if an IES was 
something else that doesn't print nicely, *`writeln` will still 
print it*.

The point of making IES play nice with `writeln` is that it is a 
major expectation of any kind of interpolation setup. People just 
expect to log interpolated sequences that have their stuff in it.

These concerns don't translate to other domains. In most SQL 
libraries, there is not a best effort function that just attempts 
to translate all data to strings and executes it.

Assigning the thing to a string doesn't work either.

Basically, you found just a very narrow example that is unlikely 
to exist, but indeed might be confusing if an exact series of 
mistakes are made. Even without IES, a user is equally likely to 
use `writef` to make the same mistake.

-Steve


More information about the Digitalmars-d mailing list