Array type conversion

Mike Capp mike.capp at gmail.com
Sat Apr 28 17:03:15 PDT 2007


Walter Bright wrote:
> Mark Burnett wrote:
>
> > Treating a container of derived as a container
> > of base is an error.
>
> But that isn't what is happening with D. base[]
> is an array of *references* to base, so the
> slicing problem one has in C++ is not possible in D

I don't think he's talking about slicing, I think he's talking about the
type-system hole. It's not unreasonable to assume when reading/debugging code that
any members of a Foo[] will be of type Foo or, if not, that a cast will have been
required somewhere to indicate that fishy things are afoot (afin?). This
conversion subverts that.

@OP: I raised this about a year ago and nobody seemed bothered then; I don't
imagine that's changed.

cheers
Mike



More information about the Digitalmars-d mailing list