"variable foo(x)" has inconsistant behavior
Closed / Fixed218546ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:59
OriginalBugID: 981 Bug
Version: 8.3b2
SubmitDate: '1998-12-16'
LastModified: '2000-01-20'
Severity: SER
Status: Released
Submitter: admin
ChangedBy: ericm
OS: All
FixedDate: '2000-01-20'
FixedInVersion: 8.3
ClosedDate: '2000-10-25'
The original bug description is below the --------snip--------- line below. That description, however, acknowledges that the bug was fixed in 8.1, by changing the behavior of "variable foo(x)". But in investigating the bug, I found this behavior:
namespace eval bar {
variable foo(1)
}
=> can't define "foo(1)": no such element in array
However:
namespace eval boo {
set foo(1) x
variable foo(1)
}
=> # no error
I corrected this by making the variable command always return an error when the variable name given refers to an array element:
namespace eval bar {
variable foo(1)
}
can't define "foo(1)": name refers to an element in an array
- eric
Original bug report below.
-------------------snip-------------------------
In 8.0.4, the command "variable foo(x)" creates a scalar variable
"foo(x)" that is not related to the foo array.
This bug is not present in 8.1, where the variable command
raises an error.
# repeatable script
namespace eval ns {
variable a
array set a {
1one
2two
}
}
proc ns::bug {varname value} {
variable $varname $value
}
ns::bug a(3) three
puts "[info vars ns::*]"
Fixed in 8.3.
- eric
-- 01/20/2000 ericm
welch Closed ticket [218546ffff].
[History diff]2000-10-26 08:24:13
Log in (anonymous is fine) to add a comment.