[MUD-Dev] New Here

Miroslav Silovic miro at puremagic.com
Fri Jun 27 16:21:53 New Zealand Standard Time 2003


MIKE MacMartin wrote:

> Also, on the subject of scripting languages, I've embedded TCL,
> but I'm thinking Ruby might be a better choice (due to the obvious
> object-oriented nature of an RPG) but I've never used it.  Any
> thoughts?

Ruby, Python or Perl are all nice. Just look for the one that's
easiest to embed (and the one you feel comfortable with).

>   struct Functor: binary_function<CCharacter&, vector<string> &, bool>  {
>     virtual bool operator()(CCharacter& ch, vector<string> & args) {
>       ch.descriptor() << "Plain functor!  Bug!";
>       return true;
>     }
>   };
>

In this specific case (the input and output types are in fact known
in advance), you might want to keep it simple:

  struct Callback{
    virtual char* operator() (const vector<string> & args) = 0;
  };

The advantage of this approach is that the structs that fail to
define the operator() will fail to compile (rather than report the
runtime error, maybe, eventually).

Also, you might be able to save yourself a lot of experimenting by
looking into Boost (www.boost.org), specifically Boost::python
library. It gives you a nice templated binding generator for
Python. It binds pretty much the entire functionality of a C++ class
to Python using very small ammount of glue code. And extensions for
other scripting languages are being planned (Tcl doesn't seem to be
among them, though).

    Miro
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev




More information about the MUD-Dev mailing list