enum Format

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Thu Jan 11 02:35:00 UTC 2024


On 11/01/2024 2:53 PM, Nickolay Bukreyev wrote:
> I’d say DIP1036, as we see it now, relies on a clever workaround of a 
> limitation imposed by the language. If that limitation is gone, the DIP 
> will become simpler.

Another potential solution would be to allow passing metadata on the 
function call side, to the function.

Consider:

``i"prefix${expr:format}suffix"``

Could be:

```d
func("prefix", @format("format") expr, "suffix");

void func(T...)(T args) {
	pragma(msg, __traits(getAttributes, args[1])); // format("format")
}

```

This is so much simpler than what 1036e is.

But it does require another language feature.


More information about the Digitalmars-d mailing list