[Grace-core] Type Parameters and parametric type

James Noble kjx at ecs.vuw.ac.nz
Tue Oct 22 15:48:10 PDT 2013


Hi Lex

a few quick thoughts - not intending to dismiss the things to which I haven't responded...

> 5. If-then-else is easy if you take the right perspective. 
> 6. Target typing helps the above problem.

the difficult here is the interaction of type dynamic / gradual typing / local type inference   and generics.
> 
> 8. For that matter, it's a reasonable trade off to just not have
> generics. Go programmers seem happy enough without them.

Yes, because Go has built-in "collection" classes - 
(notably sliceable arrays & maps) that are generic. 

Another design point is Dart, which has generic classes
but not generic methods.  They can do this because they
separate constructors from methods. 

> 9. It sounds unpleasant to use parametric types without inference; it
> would be problematic if id() and if()then()else() only ever had an
> inferred type of the dynamic type or the gradual type.

right. and this is the hard issue we're facing... 

> 10. At the same time, I would be pleasantly surprised at a design
> where type parameters are *always* inferred. Maybe I am not
> imaginative enough, but the sweet spot seems to be that most of them
> are inferred, but you can write one down explicitly if you need to.

always for some suitable meaning of always?

James


More information about the Grace-core mailing list