interfaces :-(

Kris Kris_member at pathlink.com
Fri Mar 10 01:07:11 PST 2006


In article <durcu5$2ulj$1 at digitaldaemon.com>, John Demme says...
[snip]
>C'mon... Can't we do better than this?  And actually, it'll only work
>without ugly casting if you're working with a HashMap:
>
>Map!(char[], int) myMap = new HashMap!(char[],int)();
>Map!(char[], int) originalMap = cast(Map!(char[],int)) myMap.clone();
>
>The whole point of the interface, in this case, is to encourage people to
>disconnect their code from the implemantation of the map; encourage them to
>use the interface instead.

Exactly. It's unfortunate that Interfaces are still something of a red-headed
stepchild in D ~ It's not entirely clear that Walter uses Interfaces, or fully
appreciates their powerful 'contractual' and decoupling aspects. There's no need
for such tools when you're not working in a reasonably-sized team, or trying to
build some kind of extensible library (or whatever).

D interfaces have 'just enough' to make them useful in simple cases. For that,
they are just fine ~ there's enough functionality there. Perhaps it'll mature?

- Kris





More information about the Digitalmars-d-dtl mailing list