[Grace-core] Minutes of Teleconference 2011.08.17

Kim Bruce kim at cs.pomona.edu
Thu Aug 18 15:10:25 PDT 2011


On Aug 17, 2011, at 6:19 PM, James Noble wrote:

> 
> Questions:
> 
> ** issue of creating instances of generic types still unresolved!
>     - Factory.new[Types](args) --- this is the "normal" generic method send syntax
>          and those types will hopefully be picked up via type inference
>     - Factory[Types].new(args) ---  is more java/scala like, perhaps is more consistent
>           with the use of the thing  (which will be Type[Types] or whatever)
>           but we don't have any semantics for expressions of type Factory[Types]   
> 

My argument for using the second notation is that Factory by itself is not a class.  It is a function from types to classes.  Thus Factory[SomeType] is the actual class.  Thus this class is the one we would send a new message to.  Hence
Factory[SomeType].new(args) is the correct syntax. 

Similarly if we assume the declaration of Factory is something like the following:

class Factory[T] implements GenType[T] { ... }

then not surprisingly we get the following typing:

Factory[SomeType].new(...)  :  GenType[SomeType]

Doesn't that seem more parallel?  Just as GenType by itself is not a type (stomp out "erasures"!), so Factory by itself is not a class.  Both are functions from types to types/classes.

To write it the other way it would seem like one would need to write something like:

class Factory implements GenType {[T] reg params.. -> ...}

	Kim


More information about the Grace-core mailing list