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, so I can have pir like:
$P1 = <some pmc>
$I1 = does "array"
if $I1 goto got_list
# convert to a list...
$S1 = $P1
$P1 = new TclList
$P1 = $S1
got_list:
# now $P1 has an actual list object. I've already got the code that converts a string to a list... but I can't figure out how to, from inside tcllist's set_string_native, to *replace* the existing PMC with the new list PMC. Anyone have any pointers on that, or, on a better way to solve the problem of morphing between a scalar and an aggregate?
Thanks.

Reply via email to