From 3861662698abb144b65478237d7a932180dfb710 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 10 Oct 2014 20:26:06 -0700 Subject: 128 --- mu.arc.t | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mu.arc.t b/mu.arc.t index bff33bf8..ee32202d 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -599,21 +599,17 @@ ; dynamically typed values, which save type information in memory rather than ; in the code to use them. This will let us do things like create heterogenous ; lists containing both integers and strings. -; -; Open question: should maybe-coerce to type integer return an integer or -; integer-address on success? Given that types and their addresses have no -; systematic relation, we should probably be more explicit. (reset) (new-trace "tagged-value") (add-fns '((test1 - ((1 type) <- copy (integer literal)) + ((1 type) <- copy (integer-address literal)) ((2 integer-address) <- copy (3 literal)) - ((3 integer-address) (4 boolean) <- maybe-coerce (1 tagged-value) (integer literal))))) + ((3 integer-address) (4 boolean) <- maybe-coerce (1 tagged-value) (integer-address literal))))) (run 'test1) ;? (prn memory*) -(if (~iso memory* (obj 1 'integer 2 3 3 3 4 t)) +(if (~iso memory* (obj 1 'integer-address 2 3 3 3 4 t)) (prn "F - 'maybe-coerce' copies value only if type tag matches")) ; Just like the table of types is centralized, functions are conceptualized as -- cgit 1.4.1-2-gfad0