mirror of
https://github.com/janet-lang/janet
synced 2025-12-13 20:18:06 +00:00
Assertf with no arguments does not make sense.
This commit is contained in:
@@ -154,11 +154,6 @@
|
||||
,v
|
||||
(,error ,(if err err (string/format "assert failure in %j" x))))))
|
||||
|
||||
(defmacro assertf
|
||||
"Convenience macro that combines `assert` and `string/format`."
|
||||
[x & args]
|
||||
~(as-macro ,assert ,x (,string/format ,;args)))
|
||||
|
||||
(defmacro defdyn
|
||||
``Define an alias for a keyword that is used as a dynamic binding. The
|
||||
alias is a normal, lexically scoped binding that can be used instead of
|
||||
@@ -209,6 +204,16 @@
|
||||
[fmt & args]
|
||||
(error (string/format fmt ;args)))
|
||||
|
||||
(defmacro assertf
|
||||
"Convenience macro that combines `assert` and `string/format`."
|
||||
[x fmt & args]
|
||||
(def v (gensym))
|
||||
~(do
|
||||
(def ,v ,x)
|
||||
(if ,v
|
||||
,v
|
||||
(,errorf ,fmt ,;args))))
|
||||
|
||||
(defmacro default
|
||||
``Define a default value for an optional argument.
|
||||
Expands to `(def sym (if (= nil sym) val sym))`.``
|
||||
|
||||
Reference in New Issue
Block a user