[Grace-core] [A Graceful Blog] Comment: "From Lancaster to Portland"

Andrew P. Black black at cs.pdx.edu
Mon Sep 26 18:09:32 PDT 2011


I think that we agree on this.

My conclusion is that we need a type None, to be the top (or bottom) of the type lattice, but that there should be no objects with that type.

As Kim says, for any particular application, we may make a specific null object.  For example, for trees, we will need an EmptyTree object.  Again, as Kim says, we can give these objects useful operations, so EmptyTree can have a height.

	Andrew



On 26 Sep 2011, at 17:39 , Kim Bruce wrote:

> Sorry, because of "contravariance".
> 
> Kim
> 
> 
> 
> On Sep 26, 2011, at 5:23 PM, Kim Bruce wrote:
> 
>> I was about to argue that we only needed a semi-lattice with sups, but it then occurred to me that because of covariance (related to subtyping function types), we need the joins as well.  
>> 
>> In fact, as I now recall, we ran into this with an OOPSLA paper where we ran into problems with typing conditional expressions, and we found we needed the entire lattice.  Because Java has conditional expressions, but no sups or infs (because of nominal typing), they do not fully support subtyping.  If expT: A <: C and expE: B <: C then "boolExp? expT: expE" is not typable in Java, even though it clearly has type C.
>> 
>> I also worried that banning overloading might make meets hard, but a little thought shows  we can just take the subtype of the different types in the join.
>> 
>> Kim
>> 
>> 
>> 
>> On Sep 26, 2011, at 4:01 PM, Andrew P. Black wrote:
>> 
>>> 
>>> On 26 Sep 2011, at 15:16 , Kim Bruce wrote:
>>> 
>>>> I would probably choose not to have an all-purpose "Nil" object, but instead create a new one for each type that needed one. That way, each could be given any methods that we felt necessary (and those would be different for each application).  
>>> 
>>> I agree with this position.
>>> 
>>>> 
>>>> I don't see any need for a special None type.  Can anyone enlighten me as to why we might need it?
>>> 
>>> So that types form a lattice.  If you don't have a None type, then meets (and consequently joins) may not always exist.  We want joins, so that we can type conditional expressions, and inheritance, and other things.
>>> 
>>> 	Andrew
>>> 
>> 
>> _______________________________________________
>> Grace-core mailing list
>> Grace-core at cecs.pdx.edu
>> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core
> 



More information about the Grace-core mailing list