From 12b1b74f1e952694c8f182eb2b4ab369f6005ddf Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 14 Jun 2009 12:26:50 +0000 Subject: Add support for existential type recovery. * interp/compiler.boot (compRecoverDomain): New. Split from compRecoverGuard. (compRecoverGuard): Split. Handle existential type recovery. (compScheme): New. Register as compiler. * interp/g-opt.boot (optLET*): New. Turn into LET-form if appropriate. Register as backend transformer. * interp/fnewmeta.lisp (|PARSE-Scheme|): New. (|PARSE-Quantifier|): Likewise. (|PARSE-QuantifiedVariableList|): Likewise. (|PARSE-QuantifiedVariable|): Likewise. * interp/metalex.lisp (KEYWORDS): Add 'forall' and 'exist' as new keywords. * interp/newaux.lisp: Register parser for expression schemes. * algebra/any.spad.pamphlet (=$Any): If the underlying domain has BasicType, use that equality operator. (coerce$Any): If the underlying domain has CoercibleTo OutputForm then use it. --- src/algebra/any.spad.pamphlet | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/algebra') diff --git a/src/algebra/any.spad.pamphlet b/src/algebra/any.spad.pamphlet index e7818eb2..b15f486f 100644 --- a/src/algebra/any.spad.pamphlet +++ b/src/algebra/any.spad.pamphlet @@ -143,6 +143,7 @@ import None )abbrev domain ANY Any ++ Author: Robert S. Sutor ++ Date Created: +++ Date Last Updated: June 14, 2009. ++ Change History: ++ Basic Functions: any, domainOf, objectOf, dom, obj, showTypeInOutput ++ Related Constructors: AnyFunctions1 @@ -191,7 +192,10 @@ Any(): SetCategory with obj x == x.ob dom x == x.dm domainOf x == x.dm pretend OutputForm - x = y == (x.dm = y.dm) and EQ(x.ob, y.ob)$Lisp + x = y == + case (x,y) is + (x': exist(S: BasicType) . S, y': S) => x' = y' + otherwise => EQ(x,y)$Foreign(Builtin) objectOf(x : %) : OutputForm == spad2BootCoerce(x.ob, x.dm, @@ -203,7 +207,10 @@ Any(): SetCategory with "Type of object will not be displayed in output of a member of Any" coerce(x):OutputForm == - obj1 : OutputForm := objectOf x + obj1 : OutputForm := + case x is + x': exist(S: CoercibleTo OutputForm) . S => x'::OutputForm + otherwise => (x.ob pretend SExpression)::OutputForm not deref printTypeInOutputP => obj1 dom1 := p:Symbol := prefix2String(devaluate(x.dm)$Lisp)$Lisp -- cgit v1.2.3