Chip Salzenberg <[EMAIL PROTECTED]> wrote:
> Quick question for Tcl folks.  Currently, store_lex is *always* an
> aliasing operation.  That is, after
>
>    store_lex 'a', $P0
>
> the old PMC that used to be accessible by
>
>    $P1 = find_lex 'a'
>
> is now gone (unless you kept a reference somewhere else).
>
> (To modify an existing lexical, the sequence is
>     $P1 = find_lex 'a'
> followed by some mutating operation on $P1.)
>
> Is this a problem for Tcl implementation?  If so, how?

I don't think it is, no. ParTcl implements global/lexical storage
rather naively at the moment (because I didn't understand that the lex
opcodes worked this way when I implemented this over the summer).
Right now we always use store_lex to assign to a lexical variable
instead of using the assign opcode, which breaks things like [global].

In order for things to work properly, we may have to perform 2
find_lex and 1 store_lex/assign operations for append commands
(depending on how clever we can be), but that shouldn't be an issue.
When we do switch to using assign, the [global] and [upvar] commands
should be pretty straightforward to implement (assuming we have access
to the caller's lex pad for [upvar]). But I assume that that's why
things are implemented as they are.

--
matt diephouse
http://matt.diephouse.com

Reply via email to