On Jul 30, 2006, at 2:49 PM, Bob Rogers wrote:

   From: Will Coleda <[EMAIL PROTECTED]>
   Date: Sun, 30 Jul 2006 12:36:08 -0400

   This code is not working in Tcl at the moment (at the moment, not
   sure if it ever did)

   set a [list a b]
   set a b

   Under the covers, this should create a TclList PMC and assign it to
   the global '$a'. It should then discard that value, and replace the
   value in '$a' with a String of "b".

It's apparently trying to do so by morphing $a in the
FixedPMCArray:set_pmc method . . .

   However, running this errors with:
   "Can't set self from this type"

   This error appears in one place in the parrot code base, in
   Parrot_ResizablePMCArray_set_integer_native.

Hmm . . . I find this message only in Parrot_FixedPMCArray_set_pmc,
which is inherited by ResizablePMCArray.

Whoops.


   Why is assign calling push_pmc?

And, why is RPA missing 'assign_pmc' (found in the plain ole Array) ?
   (Though adding this to RPA in my sandbox didn't help.)

Both ResizablePMCArray and FixedPMCArray have "does array" . . . but
apparently that is not the same as inheriting from Array.

Yup. "does" only matters to the "does" opcode.

  So both seem
to be using the default.pmc method instead, which re-dispatches to the
aforementioned set_pmc method.

   languages/tcl/t/tcl_misc.t#27 has a test for this behavior.

What's the generated PIR for this?


To get the pir generated by tcl (at least at the top level - there's a lot of compiling going on throughout the runtime), do:

../../parrot tcl.pbc --pir -e 'set a [list a b]; set a b'

--
Will "Coke" Coleda
[EMAIL PROTECTED]


Reply via email to