Re: strange tcl behavior



On Jun 27, 2:43 pm, Donald G Porter <d...@xxxxxxxx> wrote:
IonutAnghelcovici wrote:
When it starts the parsing the only custom command is defobj <name>
<alias>. What that command does is to create two new commands: "name"
and an alias to it called "alias".
puts $test_var
defobj custom_command custom_alias
puts $test_var
When I run the script I get the following output:
custom_command
custom_alias
Can somebody help me understand why the value of test_var is changed
to cusom_alias ?

It's hard to be sure, but the results suggest that the [defobj]
command may not be properly respecting the Copy-On-Write rules for
modifyingTclvalues.

Is the implementation of [defobj] available for review?

I've found http://ftp.swarm.org/pub/swarm/src/swarm/swarm-2.2.tar.gz
Apart from the programming langauge being objc, one striking thing is
that it seems to be using the old argc/argc command interface
(Tcl_CreateCommand). To violate COW in this case, the code must be
casting over a "const char *", but I have not yet homed in on the
spot.

-Alex
.