Will Coleda <[EMAIL PROTECTED]> wrote:

> Tcl has a need to be able to convert between Lists and Strings. All of the
> morphing samples that are in, say, PerlUndef are for scalars.

> Right now, I have a PIR method, "_Tcl::__stringToList" that takes a string,
> and then uses the tcl parser to split it up into a list.

> What I'd like to do is create a "set_string_native" method on TclList,

While it's certainly doable to morph a list to a string and vv, it's a
bit tedious and it doesn't really match you description above.

I'd just do:

  pmclass TclString ... {

   METHOD PMC* stringToList() {
      // create new list and return it
   }
   METHOD PMC* listToString() {
     return SELF; // already a string
   }
 }

 pmclass TclList ... {

   METHOD PMC* listToString() {
      // create new string from the list and return it
   }
   METHOD PMC* stringToList() {
      return SELF;
   }
 }

 $P1 = $P0."stringToList"()

leo

Reply via email to