-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On May 16, 2008, at 8:45 PM, Roger Alsing wrote:

> How do you deal with ducktyping?
> How can anyone assume that just because a method exists that the
> semantics is the same?
>
> Brush.Draw( x , y )
> vs
> Cowboy.Draw( direction, speed )
>
> The same name and signature, not even close to the same semantic
> meaning.

Actually, how do you guarantee those semantics in a statically typed  
language?

Consider this (pseudo-java, sorry ;) ):

interface Drawable
{
    abstract public void draw(int a, int b);
}

class Point implements Drawable
{
   public void draw(int x, int y)
   {
      Canvas.drawPoint(x,y);
   }
}

class CarThief implements Drawable
{
   public void draw(int x, int y)
   {
      Car c = steal(Cars.random());
      c.drive_to(x,y);
   }
}

Both Classes implement Drawable but there is no way to check on two  
"Drawable" whether
they share the same semantics.

Regards
Skade
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkgt67EACgkQJA/zY0IIRZZ1sACgmVHN1laF+Xqr72t887Pd+n3J
TwwAniR9ESpQ0gwVGcOA5r4opjn1hLJ+
=GhYL
-----END PGP SIGNATURE-----