[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 1549860 139/316: Merge pull request #296 from cire
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 1549860 139/316: Merge pull request #296 from cireu/fix-hash-opt-expander |
Date: |
Mon, 15 Feb 2021 15:57:44 -0500 (EST) |
branch: externals/dash
commit 15498602f42c19c1b8d7f8768f6b998dfd5b3a22
Merge: dca7bdc bbf8016
Author: Matus Goljer <dota.keys@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #296 from cireu/fix-hash-opt-expander
Ensure `hash?` expander evaluates its arg only once.
---
dash.el | 4 +++-
dev/examples.el | 6 ++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dash.el b/dash.el
index 4b0857f..e945fbb 100644
--- a/dash.el
+++ b/dash.el
@@ -1831,7 +1831,9 @@ kv can be any key-value store, such as plist, alist or
hash-table."
(defun dash-expand:&hash? (key source)
"Generate extracting KEY from SOURCE for &hash? destructuring.
Similar to &hash but check whether the map is not nil."
- `(when ,source (gethash ,key ,source)))
+ (let ((src (make-symbol "src")))
+ `(let ((,src ,source))
+ (when ,src (gethash ,key ,src)))))
(defalias 'dash-expand:&keys 'dash-expand:&plist)
diff --git a/dev/examples.el b/dev/examples.el
index f987d45..ff7a92d 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -1150,6 +1150,12 @@ new list."
(puthash :bar 2 hash)
(-let (((&hash :foo :bar) hash)) (list foo bar))) => '(1 2)
(-let (((&hash :foo (&hash? :bar)) (make-hash-table)))) => nil
+ ;; Ensure `hash?' expander evaluates its arg only once
+ (let* ((ht (make-hash-table :test #'equal))
+ (fn (lambda (ht) (push 3 (gethash 'a ht)) ht)))
+ (puthash 'a nil ht)
+ (-let (((&hash? 'a) (funcall fn ht)))
+ a)) => '(3)
(-let (((_ &keys :foo :bar) (list 'ignored :foo 1 :bar 2))) (list foo
bar)) => '(1 2)
;;; go over all the variations of match-form derivation
(-let (((&plist :foo foo :bar) (list :foo 1 :bar 2))) (list foo bar)) =>
'(1 2)
- [elpa] externals/dash 2fb97f0 202/316: ; Fix typo in last change, (continued)
- [elpa] externals/dash 2fb97f0 202/316: ; Fix typo in last change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 9c6a7c3 207/316: Add Makefile, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f2cd73d 211/316: Make --dotimes more hygienic, ELPA Syncer, 2021/02/15
- [elpa] externals/dash b34ddf5 210/316: Improve formatting of ellipses, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 8879c41 216/316: Use actual dash-functional.el version in README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 5a64259 218/316: ; Move -doto/--doto next to other threading macros, ELPA Syncer, 2021/02/15
- [elpa] externals/dash b3c58ff 221/316: Fix docstring of -list, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 26f065f 129/316: Merge pull request #282 from yyoncho/anamorphic-doto, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 4abffdc 123/316: Update docs, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 677c156 134/316: Merge pull request #290 from leungbk/rotate, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1549860 139/316: Merge pull request #296 from cireu/fix-hash-opt-expander,
ELPA Syncer <=
- [elpa] externals/dash 93e0465 137/316: Remove dependecy `macroexp`, ELPA Syncer, 2021/02/15
- [elpa] externals/dash a358b79 143/316: Speed up `-uniq` with hash-table., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 77f3bf4 142/316: Merge pull request #302 from bbatsov/patch-1, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 38dc929 222/316: Fix, improve, and extend anaphoric folds, ELPA Syncer, 2021/02/15
- [elpa] externals/dash d308676 225/316: Fix signal argument and case where start is null, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 994cda9 228/316: Simplify -cons-pair?, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 11907f4 145/316: Speed up `-uniq` with hash-table. (#305), ELPA Syncer, 2021/02/15
- [elpa] externals/dash ad21e13 146/316: Ignore all .elc and TAGS files, ELPA Syncer, 2021/02/15
- [elpa] externals/dash fae51b5 147/316: Make -inits not destroy its argument, ELPA Syncer, 2021/02/15
- [elpa] externals/dash ce1294b 152/316: Optimize non-destructive -inits, ELPA Syncer, 2021/02/15