|
2020-11-16
| ||
| 13:57 | • Closed ticket [d8ae5d5f4c]: Documentation of dict filter script: script results,... artifact: c3458a6f91 user: oehhar | |
| 13:55 | Ticket [d8ae5d5f4c]: Documentation of dict filter script: script results, not returns a boolean check-in: e4f600329a user: oehhar tags: oehhar-documentation-tickets | |
|
2020-11-03
| ||
| 20:06 | • Ticket [d8ae5d5f4c] Documentation of dict filter script: script results, not ret... artifact: 4d7b3b5eff user: bll | |
|
2020-11-02
| ||
| 14:18 | • New ticket [d8ae5d5f4c]. artifact: 822d6eec9c user: oehhar | |
Documentation of dict filter script: script results, not returns a boolean
Closed / Fixedd8ae5d5f4c1e248b715b2a2d90ed746dbfb5f2edCreated 6 years agoUpdated 6 years ago
Descriptionwiki2020-11-02 14:18:38
The description of dict filter script includes:
"and then evaluating the given script which should return a boolean value."
IMHO, the script should result in a boolean value, not return one. For me, "return" is the return command, not a result.
I tried:
% dict filter {a 1 b 2} script {k v} {return 1}
1
% dict filter {a 1 b 2} script {k v} {expr 1}
a 1 b 2
Perhaps I am dump, but the description lead me to this error.
References below.
Thank you, Harald
See http://www.tcl.tk/man/tcl8.6/TclCmd/dict.htm#M10 :
dict filter dictionaryValue script {keyVariable valueVariable} script
The script rule tests for matching by assigning the key to the keyVariable and the value to the valueVariable, and then evaluating the given script which should return a boolean value.
Referenced by1
e4f600329aTicket [d8ae5d5f4c]: Documentation of dict filter script: script results, not returns a boolean check-in2020-11-16 13:55:33
bllplain2020-11-03 20:06:46
The 'return 1' is returning from the current scope.
If you used:
proc z { } {return 1}
dict filter {a 1 b 2} script {k v} z
it would work.
The inline-script is not processed in the same manner as normal scripts,
and I suspect is not creating a new scope.
There are several commands that use these inline-scripts. I don't like them.
It's like having a secondary language within Tcl.
Not that the documentation about break and continue only apply to the
inline-script, not to any script called by the inline-script.
oehharwiki2020-11-16 13:57:12
Committed with [e4f600329a] in branch hao-documentation-tickets for review
Log in (anonymous is fine) to add a comment.