[Issue 2367] Overloading error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 20 15:25:53 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2367





------- Comment #2 from andrei at metalanguage.com  2008-09-20 17:25 -------
Even with polysemy, vocables may have a principal meaning. For example "1" is
polysemous because it fits byte, ubyte etc. but absent any constraint it will
prefer to be an int.

auto i = 1; // i's type is int

As discussed with Walter, strings are also easy to acquire a principal meaning.
One possibility discussed is that strings with only ASCII characters to have
invariant(char)[N] as principal type. In fact the N should be dropped too for a
number of reasons. So "a" should have principal type invariant(char)[]. (If a
constraint is present, no problem.)

The exaggerated ambiguity of string literals has caused much grief to many
people, it's about time to fix it.


-- 



More information about the Digitalmars-d-bugs mailing list