On Thursday 06 March 2008 06:22:21 Will Coleda wrote:

> in PDD17, the following program (which prints "b\n" in trunk), dies:
>
> $ ../../parrot tcl.pbc -e "puts [concat {expand}[lindex {a b} 1]]"
> argument doesn't array.

Ha.  The problem's not Parrot (as far as I can tell) but Tcl.  {a b} is a 
two-element list, right?

Take t/cmd_expr.t, which sets a variable named TODO:

set TODO {TODO "correct precision"}

# math functions, happy path
is [expr abs(-1)]       1
is [expr abs(1)]        1
is [expr abs(1.0)]      1.0
is [expr abs(-1.0)]     1.0
is [expr acos(0)]       1.5707963267948966 {} $TODO
is [expr asin(1)]       1.5707963267948966 {} $TODO

The acos() and asin() tests cause an abort in Parrot, with the "argument 
doesn't array" message.  This makes sense; is() expects that the fourth 
argument is a two-element list:

proc is {value expected {description ""} {special {}}}  {

However, if you dump this code to PIR, you'll see:

   $P102 = new 'TclString'
    assign $P102, "TODO"
    $P103 = new 'TclString'
    assign $P103, "TODO \"correct precision\""
  if epoch != 0 goto dynamic_109
  .local pmc a_varName_108
a_varName_108 = $P102
  .local pmc a_newValue_108
a_newValue_108 = $P103
.local pmc temp

  if null a_newValue_108 goto read_var_108

  .local pmc set_108
  set_108 = get_root_global ['_tcl'], '__set'
  $P104 = set_108(a_varName_108, a_newValue_108)

... which indicates to me that TODO gets stored as a string, not a list.

-- c

Reply via email to