the cast mess
schveiguy at yahoo.com
Mon May 18 06:38:55 PDT 2009
On Mon, 18 May 2009 05:09:10 -0400, Don <nospam at nospam.com> wrote:
> Vladimir Panteleev wrote:
>> Hello digitalmars.D,
>> I'm concerned about the cast() situation with D. Right now, we use the
>> same keyword and syntax to do three different things:
>> 1) The obvious plain-old-data cast (casting one pointer type to
>> another, structures, etc.)
>> 2) Type conversion casts (casting floats to ints)
>> 3) Dynamic casts for classes (may result in null)
>> (There may be more magic going on behind the scenes when e.g. casting
>> between arrays with different element sizes - a proposal I saw some
>> time ago to replace start/length with start/end would get rid of that)
> 4) removing const/immutable.
5) casting TO immutable. Note that this is far too easy, since the
implications are not provable by the compiler.
I'm all for overhauling the cast system, As long as we can make the syntax
better than C++ (and I suspect we can).
More information about the Digitalmars-d