grep

Dee Girl deegirl at noreply.com
Sat May 10 09:15:50 PDT 2008


terranium Wrote:

> terranium Wrote:
> 
> > Dee Girl Wrote:
> > 
> > > Your example compiles but it was so good if it did not. Modifiable arrays should never be covariant!
> > 
> > Compiles and works? There is no problem with covariance, it just needs runtime typechecks for assignment.
> 
> The problem is array (unlike java and .Net) is a primitive type, so it doesn't have TypeInfo and doesn't know what it's supposed to contain, so it can't do typechecks.

Maybe check insertion could be arranged by the compiler. Java does that. But it is generally better to detect type errors earlier. D has const so not much expressive is lost. Dee Girl



More information about the Digitalmars-d mailing list