[Prev][Next][Index][Thread]

Re: HARLEQUIN DYLAN and C FFI



On Wed, 2 Feb 2000 01:00:02 -0500 (EST), "Shawn" <shawn@anarchy-arts.com>
wrote:

>     Thanks Douglas:
> 
>     Yes I thought that Harlequin Dylan would allow me to step away from
> using C/C++ for my development (PC Games) but it seems to have floated off
> into obscurity. 

That would be a shame because we're still here.

> I chanced acrossed Dolphin Smalltalk and was amazed at how
> easy it appears to be.  I need a language that can replace C/C++ but still
> use the available SDK's out there for graphics and music, like FMOD. I am
> currently looking at squeak now. Does Smalltalk come in like a bazillion
> flavors ?

[ Ironically, "Dolphin" was one of the candidate names for Harlequin's Dylan
that we were bandying about a couple of years ago... ]

I don't want to dis' Smalltalk since it will be better than C/C++ (as will
Common Lisp, OCAML, or even Java). However, Dylan is a modern fusion of the
best ideas from languages like Smalltalk and Common Lisp. E.g. Smalltalk has no
multiple inheritence or multiple argument dispatch. I personally think that
these are very useful attributes for modelling agents and environments -- the
kinds of entities you get in games programming.

E.g.

// Dylan

define method engage (agent ::  <agent>, target :: <agent>)
  move-to(agent, position-of(target));
  attack(agent, target);
end method;

define method engage (agent :: <mouse>, target :: <cat>)
  squeak("Not likely!");
  move-to(agent, position-of($mouse-hole);
end method;

// Java

class Agent {
  void engage (Agent target) {
    moveTo(target.positionOf);
    attack(target);
  }
}

class Mouse extends Agent {
  void engage (Agent target) {
    if (agent instanceof Cat) { // oops no multi-arg dispatch in Java
      squeak("Not likely");
      moveTo(Location.MOUSE_HOLE.positionOf());
    }
    else {
      super.engage(agent);
    }
  }
}

__Jason


Follow-Ups: References: