Skip to content

Commit 4b17105

Browse files
yuhan0bbatsov
authored andcommitted
Deprecate 3-argument call to nrepl-dict-get
Calling the function with 3 arguments will continue to work, but raise a warning during byte compilation.
1 parent 5464139 commit 4b17105

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

nrepl-dict.el

+9-3
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,20 @@ whose car is KEY. Comparison is done with `equal'."
6161
(member key (nrepl-dict-keys dict)))
6262

6363
(defun nrepl-dict-get (dict key &optional default)
64-
"Get from DICT value associated with KEY, optional DEFAULT if KEY not in DICT.
65-
If dict is nil, return nil. If DEFAULT not provided, and KEY not in DICT,
66-
return nil. If DICT is not an nREPL dict object, an error is thrown."
64+
"Get from DICT value associated with KEY.
65+
If DICT is nil, return nil.
66+
If DICT is not an nREPL dict object, an error is thrown.
67+
68+
If KEY is not in DICT, return DEFAULT (if provided).
69+
Note that the use of DEFAULT is deprecated and will be
70+
removed in a future release."
71+
(declare (advertised-calling-convention (dict key) "1.16"))
6772
(when dict
6873
(if (nrepl-dict-p dict)
6974
;; Note: The structure of the following expression avoids the
7075
;; expensive containment check in nearly all cases, see #3717
7176
(or (lax-plist-get (cdr dict) key)
77+
;; TODO: remove DEFAULT argument and the following clause
7278
(when default
7379
(and (not (nrepl-dict-contains dict key))
7480
default)))

0 commit comments

Comments
 (0)