On Saturday, 3 August 2013 at 11:39:44 UTC, David Nadlinger wrote:
On Monday, 29 July 2013 at 05:05:54 UTC, Denis Shelomovskij
wrote:
So is enhancement request filed?
Now it is: http://d.puremagic.com/issues/show_bug.cgi?id=10750
Sorry, I'm not following the lists closely right now due to
university work.
David
C++ (and C, afaik), solved the problem by saying "char" can alias
anything. I'm not sure that's a good idea to do the same in D,
since a char actually represents something very specific, and
comes with bagage.
We could have (u)byte do this, but at the same time, I see now
reason why *they* should have to pay for lax aliasing.
A "simple" solutions I see:
Introduce the "raw" basic data type. It's basically a ubyte for
all intents and purposes, but can alias to anything. I think this
is a good idea, as the useage of the ward "raw" is immediately
very explicit and self documenting about what is going on:
auto rawSlice = (cast(raw*)(&arbitraryData))[0 ..
arbitraryData.sizeof];
The *cost* here, of course, is the introduction of a new *type*.
The cost is very high, but at the same type, it deals with the
problem (I believe), in the most elegant fashion possible.
Thoughts?