Closed ahumph closed 3 years ago
On the sixth command, why would $b(two)
evaluate to 0, when no default has been declared for array b
?
And I would discuss whether referencing a hitherto non-existing element (and getting the default value) should actually create the array element. In other words, maybe the parray
in the example above should include the values for two
as well.
Ah that was a typo. If no default is set the standard TCL error message is returned.
Currently the non existing elements are not created, but this can be added pretty simply. Alternatively, an extra argument could be added to make this optional.
Any update on this issue?
Specifically: is creation of a requested non-existing element desired, and if so, should it be optionally specified in the command?
Looking at this now.
Why a list of {array-name value...}?
What's wrong with multiple [array default array_name value]?
The value should not be instantiated in the array.
I confirm that an implementation of array default
will be available from the next release of Tcl 8.7, using code linked to #31; I believe that this issue can be Closed.
Two years later, this is still labeled as an open item -- is it?
I have a basic patch ready for this. Usage would be as follows:
If there are any comments on this usage let me know, and I can modify before submitting a TIP.
Edit: Fixed return for $b(two)