[Grace-core] Class syntax and type parameters

Andrew P. Black black at cs.pdx.edu
Fri Nov 14 22:46:40 PST 2014


On 14 Nov 2014, at 16:37, Marco Servetto <marco.servetto at gmail.com> wrote:

> a polimorphic method is a method that return a different type
> depending on the type of the arguments.

By this definition, I don’t think that we have polymorphic methods.

We have methods with type parameters — these return an object with a type that depends on the value of the type parameter.  
We could code up methods where the type of the result depends on the type of the argument, using reflection, but such methods are
not supported by the type system.     

Of course, we do have genericity in the usual object-printed sense: the method executed depends on the (class of the) receiver, and thus the type of the result can also depend on the type of the receiver.   Each of these methods has a separate signature.   

> no, if foo[bar] is a thing that conceptually generate and typecheck the
> foo over bar, then foo[x] is a method that return "code"
> and that is the end of the story, with no parametricity ever

Sorry, I’ve no idea what this means.   Can you explain it to  me in different words?

	Andrew

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailhost.cecs.pdx.edu/pipermail/grace-core/attachments/20141114/f7d50fd6/attachment-0001.html>


More information about the Grace-core mailing list