On 19 Aug., 20:45, Reinier Zwitserloot <reini...@gmail.com> wrote:
> disjoint types are structural in that you weaken the namespacing of
> members.
>
> Members are only namespaced by virtue of their container. So lets say
> I do this (I apologize in advance for the cliché factor of this
> example):
>
> public class com.ren.Gun {
>     public void shoot() { System.out.println("BANG!"); }
>
> }
>
> public class com.stimpy.Camera {
>     public void shoot() { System.out.println("Smile!"); }
>
> }
>
> public void pointAndClick(Gun | Camera object) {
>     object.shoot();
>
> }
>
> should that be legal code? I'd argue no - the fact that both Gun and
> Camera have a 'shoot' method is a pure coincidence.

I don't think that argument works here. Yeah, idiots will be idiots,
but it would take an extraordinary idiot to call shoot() on an object
of type "Gun|Camera". Why do you insist on having more slack in your
type system, just to exclude a tiny class of errors that noone is
going to make anyways?

With kind regards
Ben
--~--~---------~--~----~------------~-------~--~----~
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