Discussion Thread: DIP 1036--Formatted String Tuple Literals--Community Review Round 1

Adam D. Ruppe destructionator at gmail.com
Fri Sep 11 19:04:23 UTC 2020


On Friday, 11 September 2020 at 18:32:05 UTC, Paul Backus wrote:
> What do we gain by adopting a *third* convention from 
> Javascript?

The complexity of the format spec may seem superfluous, however 
it serves four key roles:

     1. It divorces the compiler entirely from details of 
generated format strings. For example, different functions that 
accept format strings might use different default format 
specifiers.
     2. It allows overloading existing string-accepting functions 
to prevent accidental usage that happens to fit the parameter 
list (see example below).
     3. It provides necessary error checking capabilities.
     4. It provides an additional API for user functions to 
introspect the string, building on D's existing compile-time 
capabilities.


More information about the Digitalmars-d mailing list