contravariant argument types: wanna?

Justin Johansson procode at adam-dott-com.au
Tue Sep 22 19:11:25 PDT 2009


Jeremie Pelletier Wrote:

> bearophile wrote:
> > Andrei Alexandrescu:
> > 
> >> Today D does not support contravariant arguments, but Walter told me 
> >> once he'd be quite willing to implement them. It is definitely the right 
> >> thing to do, but Walter would want to see a compelling example before 
> >> getting to work.
> >> Is there interest in contravariant argument types? If so, do you know of 
> >> a killer example?
> > 
> > Let's fix fix the holes in the logic of the module system and other basic things like returning static arrays, etc. Then we can think about adding contravariant argument types.
> > Very common and simple things that work first, complex things that are useful only once in while later.
> > 
> > Bye,
> > bearophile
> 
> I think the development priorities in D are also to get a final D2 
> specification, and then work out the issues. Its much less work in the 
> end since you can possibly break things with every new feature so the 
> sooner the spec is final the sooner we can get a stable D2 release.
> 
> I myself want to see covariant arguments :)
> 
> Jeremie

I well understand bearophile's concern but I think Jeremie has a good point.

It is important to try and set the scope of the D2 work asap and then forever more steer clear of feature creep.

Another poster on this forum, Graham St Jack, has raised issued about the shared mechanism being up in the air.  Whilst this has nothing to do with the co/contra variance issue, it is telling of grass roots instability at the requirements engineering & spec level.

>From my point of view I will resist all temptation to move from D1 to D2 until the language spec itself stabilizes.  I don't mind if an implementation has a few (or even few more than desirable); if the language spec is a moving target then that's another issue and all the more reason to stick with the legacy/stable version.

So summing up, it would be great to see the language features specified and bugs ironed out of the spec first (Jeremie's take) and then see feature creep halted and implementation bugs fixed (bearophile's desire).

-- Justin Johansson




More information about the Digitalmars-d mailing list