Adam D. Ruppe:

> Can you make it work in some situations without breaking the others? If you 
> have a
> compile time string passed in, it could check the argument count, but not all
> strings are compile time. I use runtime concatenated strings to format() like
> functions where additional data is requested on a branch.

Some format strings are known at compile time and others aren't. In most cases 
my format strings are literals in place. GCC tests them if they are literals in 
place, otherwise it ignores them. I think this is good enough. DMD may test 
them at compile time if the format strings are known at compile time, they are 
literals in place or enums or global/static const/immutable.


> I've actually wondered in the past if doing overloads based on if it is known 
> at
> compile time or not is possible. Any ideas?

The latest ideas regarding writeTo() will allow to use better formatted output 
on user defined types. When arguments are user-defined ones the compile-time 
test pass may just ignore them and just test if their count matches.

Bye,
bearophile

Reply via email to