Ben Schulz wrote:
>> Obviously you gained type safety,
>>
>> Isn't that kinda the point of a type system?  :-)
>>     
>
> I suppose, but for me it's more about why I should write down the
> types. If we asked Gilad Bracha, he'd probably say it's a bad idea
> because they restrain your thinking. Me, I say it's good because the
> compiler can verify that all messages sent are understood by their
> receivers. Structural unions would get me much farther in that
> direction and that's where I want to go. If I understand it correctly
> (and I can only hope in this case) I would not need to write down any
> types if higher-order unification was decidable. Wouldn't that be
> nice?
>   
I'm all for manifest typing: 
http://blog.peterbecker.de/2008/05/i-manifest-typing.html

But I find that the notions of "anything that is X and Y" and "anything 
that is X or Y" are natural concepts in such a system, which should be 
easily expressible. I tend to think of it in terms of Formal Concept 
Analysis[1], where these would be the join and meet operations in the 
complete lattice you get if you allow them. One nice thing is that they 
give you the missing type in this:

interface X extends A,B {...}
interface Y extends A,B {...}

In Java the supertype of X and Y is not clear. It is X|Y, which in a 
closed world would be the same as A&B. [for the reference: this is 
called the Dedekind-McNeill completion]

While this all might sound very academic, I find it very intuitive and 
tend to see the same in less mathematically inclined people. Saying 
"either X or Y" and "both A and B" is quite natural and the fact that 
you can not express either statement in the current type systems is a 
limitation IMO. Since a complete lattice is computationally not too bad, 
I really wonder why no one addressed this issue yet. The cynic in me 
thinks it is just because programmers love thinking in trees.

  Peter


[1] http://en.wikipedia.org/wiki/Formal_concept_analysis



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javaposse@googlegroups.com
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to