summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2017-01-27 17:46:00 -0600
committerNicolas Williams <nico@cryptonector.com>2017-01-30 14:11:05 -0600
commitbd7b48c1b97063bd21aa7e264e61ea3350145486 (patch)
treedbed47060c389967523c33d78e78aa09eb3e8619 /docs
parentaac8132f47435ef2d44411df327d90350e92bef6 (diff)
Make |= delete LHS when RHS is empty (Fix #1314)
Now that #1313 is fixed, |= no longer outputs null when the RHS update expression outputs empty. When a user wants to keep the current value of the LHS they would have the RHS update expression output `.`, so having `empty` achieve the same thing would be redundant. The obvious thing to do is to delete the LHS when the RHS update outputs `empty` (i.e., doesn't output any values). It's reasonable to think that existing programs won't be broken by this change, because reduce and |= not handling empty well is clearly a bug. (Though it's possible that some programs were using empty to quickly terminate reduce or |=, it's not likely. They should use label/break instead.) Prior to this change |= would use the _last_ value output by the RHS update expression. With this change |= will use the _first_ value instead. This change _is_ a minor backwards-incompatible change. It may or may not be acceptable; we'll see. It is a useful change in that it makes |= faster when the update expression produces multiple values.
Diffstat (limited to 'docs')
-rw-r--r--docs/content/3.manual/manual.yml8
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml
index ae7a9d39..8eb1a0c4 100644
--- a/docs/content/3.manual/manual.yml
+++ b/docs/content/3.manual/manual.yml
@@ -2818,8 +2818,12 @@ sections:
not a valid or useful path expression in `.`); use `$var |
.foo |= . + 1` instead.
- If the right-hand side outputs multiple values, only the last
- one will be used.
+ If the right-hand side outputs no values (i.e., `empty`), then
+ the left-hand side path will be deleted, as with `del(path)`.
+
+ If the right-hand side outputs multiple values, only the first
+ one will be used (NOTE: it used to be that only the last one was
+ used).
examples: