From ad0f1353767d1425cea0dc4c26338c2b4368a9c1 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Tue, 14 Feb 2023 08:39:52 -0800 Subject: [PATCH] Don't let defs shadow builtins. --- implementations/Nim/joy.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/implementations/Nim/joy.nim b/implementations/Nim/joy.nim index 8a12d4c..7bd03f3 100644 --- a/implementations/Nim/joy.nim +++ b/implementations/Nim/joy.nim @@ -573,7 +573,9 @@ proc add_def(def: string, dictionary: var JoyMapType) = let sym = d.head case sym.kind: of joySymbol: - dictionary = dictionary + (sym.symVal, d.tail) + let def = dictionary.get(sym.symVal) + if def.isEmpty: + dictionary = dictionary + (sym.symVal, d.tail) else: raise newException(ValueError, def)