On Tuesday, May 15, 2012 10:39:21 Manu wrote:
> Nobody?
> Is this intentional, or a bug? Some way that this makes sense that I don't
> understand?
> Does Colour somehow transfer its scope to the default arg? That string
> doesn't seem to compile...
> 
> On 14 May 2012 15:52, Manu <turkey...@gmail.com> wrote:
> > void function(Colour c = Colour.white) f;
> > 
> > f.stringof == "void function(Colour c = white)"
> > 
> > Error: undefined identifier 'white'
> > 
> > 
> > This is rather hard to work-around. It'll take a lot of time to write code
> > to magically put 'Colour.' back there...
> > Is there another way?

I suspect that stringof was never intended for anything but informative 
output, and in this case, for whatever reason, it doesn't bother to put the 
enum's name on the enum value. And if it was just intended for informative 
output, then it's not necessarily tested for compilability (hence the fact 
that the enum's name is missing in the default argument is permitted).

Given that it _does_ make sense to use stringof for string mixins, I'd create 
a bug report on it, since it won't compile the way that it is.

- Jonathan M Davis

Reply via email to