Array type conversion
Mark Burnett
unstained at gmail.com
Sat Apr 28 15:16:29 PDT 2007
Walter Bright Wrote:
> >
> > They're not safe in general,
>
> Why not?
You can end up performing operations associated with one type on an object that is not that type as demonstrated in fruit3.d with the core() function. I appreciate that silicing is not the problem. It's this (seemingly?) undefined behavior that is.
I did, however, find how to achieve the behavior I was looking for with interfaces. Arrays of objects are not implicitly converted to arrays of their interfaces. Which brings me to a quick tangent question: Are there still plans to implement interface contracts? I was just reading an old usenet thread about the posibility.
FYI, contracts and integrated unittest are two major feature draws for me (scientists often write awful code). All-in-all I am strongly leaning toward d for my project. I hope more people start cactching on to how good it looks ;)
Thanks again,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fruit3.d
Type: application/octet-stream
Size: 1584 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070428/9a10917e/attachment.obj>
More information about the Digitalmars-d
mailing list