[Issue 12357] Untyped string variable fails silently. No compiler warning given.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 13 07:18:52 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12357



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-13 07:18:51 PDT ---
(In reply to comment #2)
> I'm not sure it all is to blame on the whole property thing...
> 
> 1) The text function in the "setter" call returned a value that was unused. I
> think text in this case is a pure function, so that's a noop and potentially
> could be an error for that reason.

Yeah.

> 2) In the second case, it calls text with zero arguments, which i don't think
> ever makes sense. Perhaps we could change the signature to add an if(T.length)
> constraint to text.

I didn't even catch the second call. We could fix this right now. Although,
would any generic code break? E.g.:

void doStuff(T...)(T t)
{
    call(t[0]);
    writeln(text(t[1..$]));  // would end up failing if T.length is 1
}

I fear the 'if(T.length)' would have to be used at the call site too. I'm not
sure if this is a problem.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list