[Issue 9112] Uniform construction for built-in types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 7 10:57:48 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9112
--- Comment #14 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-12-07 10:57:47 PST ---
> So we're introducing C++-style casts into D? This means you can no longer
> search for 'cast' and expect to find all the unsafe casts in your code. I'm
> very much against this, and if I remember right Walter was also against this.
I'd actually argue for making it so that no explict casting is involved. It
could be restricted to cases where
T var = literal;
and
T var = T(literal);
would be identical. So, stuff like ubyte(12345) would be illegal whereas
cast(ubyte)12345 would be legal. It then looks like a C++ cast but isn't. It
solves the problem with generic code without causing any issues you get with
casts.
> We can also use a library template to do it without introducing new syntax. If
> orthogonality is needed because of metaprogramming then why not just implement
> a template in Phobos?
I tried that. Andrei rejected it, and it's not worth my time to fight him over
it. Not to mention, I've always thought that
auto i = new int(7);
auto j = new immutable(int)(5);
should be legal and think that having to do something like makeNew!int(7) is a
bit of a hack anyway, since it's specifically working around a deficiency in
the language.
> We really don't need 10 ways of doing the same thing with a different syntax..
The whole point of this is to try and make things more consistent, not less.
--
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