From 1bf9944ff149e363ec1b0b72b95677f15b0fb78e Mon Sep 17 00:00:00 2001 From: Ian Piumarta Date: Fri, 5 Jul 2024 17:19:32 +0900 Subject: [PATCH] String literals make fresh copies of themselves every time they are evaluated. --- minproto.leg | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/minproto.leg b/minproto.leg index 882c1b8..48a77e4 100644 --- a/minproto.leg +++ b/minproto.leg @@ -1,9 +1,9 @@ # minproto.leg -- minimal prototype langauge for semantic experiments # -# last edited: 2024-07-04 10:07:00 by piumarta on zora +# last edited: 2024-07-05 17:16:16 by piumarta on zora-1034.local %{ - ; +; //#define YY_DEBUG 1 #ifndef GC @@ -3907,7 +3907,10 @@ oop eval(oop exp, oop env) # if PRIMCLOSURE if (Lambda == type) return newClosure(exp, env); # endif - if (Object != type) return exp; + if (Object != type) { + if (String == type) return newStringLen(_get(exp, String,value), _get(exp, String,length)); + return exp; + } if (!opt_O) { Object_push(trace, exp); if (opt_d && opt_v) {