[Issue 12013] static array of chars implicitly converts to string
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 27 13:46:06 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12013
--- Comment #3 from Adam D. Ruppe <destructionator at gmail.com> 2014-01-27 13:45:59 PST ---
The D language also has a type system that should catch such problems
statically... but I think this is three bugs coming together:
1) static arrays are implicitly sliced. i think this is a mistake since it
doesn't let you easily keep track of where the references are going. It is easy
enough to do [] when you want one.
2) it is an implicit cast from mutable to immutable. Generally ok since static
arrays are value types, but when combined with the implicit slice it is a
problem.
3) it is an escaping reference to stack data. This isn't supposed to be allowed
in D I think.
char[8] => string alone should be illegal
but it might do:
char[8] => immutable(char[8]), which makes sense alone in the same way int =>
immutable(int) is logical
but then auto slice it, immutable(char[8]) => immutable(char)[]... and now
we've entered insanity.
--
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