[Grace-core] Names for the […] literal

Andrew P Black andrew.p.black at gmail.com
Mon Feb 8 19:10:32 PST 2016


On 8 Feb 2016, at 18:27 , James Noble <kjx at ecs.vuw.ac.nz> wrote:


> type one { foo(x) }
> type two { foo(x, y) } 

These are misleading, since the argument names are not, and never have been, part of the types.  They are there for documentation purposed only.  More properly, these types would be written as 

> type one { foo( ) }
> type two { foo( ,  ) } 

The method names in these two cases are different, so 

    type two & three = type {  foo( )  ;   foo( ,  ) } 

No problem.   All the types exist to build a complete lattice.  

As a matter of style, we might choose not to do this, but to instill in our library writers and students the convention that they should write

    type two { foo() and () } 

instead,  but for purposes of type completeness there is not problem.

Not also that the diffeence between  `foo( )` and `foo( ,  )`  is purely syntactic, just like the distinction between `foo( )` and  `foo() and ()`.  We unlike Java, we don't need to do a type analysis to decide what method to send.   It's that type analysis that leads to "overloading" and the confusion with "overriding"  In my opinion, allowing both `foo( )` and `foo( ,  )` is not more overriding than allowing both `foo( )` and  `foo() and ()`.  In both cases, we have a pair of syntactically distinct method names.

I don't understand your phraseology when you write: 

> option 2 - permit overloading in types but NOT in objects
> so intersection types will exist but are uninhabitable

	Andrew





More information about the Grace-core mailing list