> > Lists are preserved in Tcl as arrays of Tcl_Obj's.  If I do the
following:
> >
> >         proc makeList {size} {
> >                 set output ""
>
> Is there any difference in initializing output to list at first, or is
> there no difference. IOW, should I initialize 'output' to a list object,
> or does 'set output ""' just create an untyped object?
>
>    set output [list]  <--- does this have any affect?

At this point no, although future improvements in post-processing of
bytecodes (bc-optimization) could cause that to be significant.

Right now:

1:      set output ""
2:      set output {}
3:      set output [list]

all create *untyped* empty objects.  Doing a lappend or append on them
causes very little overhead in typing the object.  It's more a matter of
style, and sometimes I do write 'set output [list]'.  Some people use
'set output ""' to indicate a simple var vs. 'set output {}' for list
vars (since lists uses {}s in their stringified form).

  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/
      Tcl Support and Productivity Solutions

Reply via email to