1
1
mirror of https://github.com/kanaka/mal.git synced 2024-08-16 17:20:23 +03:00

make: fix catch of undefined plain symbol

The _error function was returning an empty string which meant that in
the try*/catch* implementation, the lack of result was preventing
foreach from being used as a "let" form and because of that it was
skipping the catch* handling path.
This commit is contained in:
Joel Martin 2019-07-31 00:06:37 -05:00
parent a4ff3ec9a6
commit 0c24028216
2 changed files with 9 additions and 5 deletions

View File

@ -68,11 +68,6 @@ __var_print = $(foreach v,$(1),\
_visualize_memory = $(foreach var,$(sort $(foreach vv,$(filter $(__obj_magic)_%,$(.VARIABLES)),$(call __var_name,$(vv)))),$(call __var_print,$(__obj_magic)_$(var)))
# Errors/Exceptions
__ERROR :=
_error = $(eval __ERROR := $(call _string,$(1)))
# Constant atomic values
__undefined = $(__obj_magic)_undf_0
__nil = $(__obj_magic)__nil_0
@ -80,6 +75,11 @@ __true = $(__obj_magic)_true_0
__false = $(__obj_magic)_fals_0
# Errors/Exceptions
__ERROR :=
_error = $(eval __ERROR := $(call _string,$(1)))$(__nil)
# General functions
# Return the type of the object (or "make" if it's not a object

View File

@ -10,6 +10,10 @@
(try* 123 (catch* e 456))
;=>123
(try* abc (catch* exc (prn "exc is:" exc)))
;/"exc is:" "'abc' not found"
;=>nil
(try* (abc 1 2) (catch* exc (prn "exc is:" exc)))
;/"exc is:" "'abc' not found"
;=>nil