[Issue 9112] Uniform construction for built-in types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 11 05:02:14 PST 2012


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



--- Comment #18 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-11 05:01:27 PST ---
(In reply to comment #16)
> (In reply to comment #15)
> > > AFAIK, it's not exactly the same thing, as int(10) would be only a
> > > constructor, so would not downcast.
> > 
> > I agree, but if you look at Kenji's proposal, he specifically says that there's
> > a cast involved (which I'd missed when I read it the first time). So, Andrej's
> > complaint is completely valid given Kenji's initial proposal. But if you fix it
> > so that no cast is involved, then I think that it's fine.
> 
> I'm just wondering if that's *actually* what's going on, or if Kenji just
> accidentally miss-commented it that way.
> 
> I don't know how to read compiler code, so I wouldn't know what he actually
> did. It'd be nice if he did deliver a fail_compile checking this.

You pointed out is correct.

At first, I had considered that int(10) should be translated to cast(int)10.
But, while implementing pull, I had discovered the incorrect cast would occur
much easily.

So now, the posted pull doesn't implement int(10) as a cast, and the syntax
accepts only a value which implicitly convertible to int.

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


More information about the Digitalmars-d-bugs mailing list