Dear Gaby, Waldek,
I tried today to port from open-axiom the feature that allows an ordinary
function to return a type, but failed. I.e.:
-------------------------------------------------------------------------------
)abbrev package EXPORT ExportType
ExportType(x: Ring): with
baseRing: () -> Ring
== add
baseRing() == x
-------------------------------------------------------------------------------
I := baseRing()$EXPORT INT
1$I
should give [EMAIL PROTECTED]
Curiously, *that* feature works with the patch below, but there are lots of
regressions. It seems that "Complex INT" does not work anymore:
(3) -> m: Complex INT := 1
>> System error:
Caught fatal error [memory may be damaged]
Gaby, does that ring a bell? Help would be greatly appreciated!
Martin
Index: i-analy.boot
===================================================================
--- i-analy.boot (Revision 364)
+++ i-analy.boot (Arbeitskopie)
@@ -208,6 +208,11 @@
-- Also see I-SPEC BOOT for special handlers and I-MAP BOOT for
-- user function processing.
+isCategoryForm(x,e) ==
+ x is [name,:.] => categoryForm? name
+ atom x => u:= get(x,"macro",e) => isCategoryForm(u,e)
+
+
bottomUp t ==
-- bottomUp takes an attributed tree, and returns the modeSet for it.
-- As a side-effect it also evaluates the tree.
@@ -258,6 +263,11 @@
argModeSetList:= [bottomUp x for x in argl]
ms := bottomUpForm(t,op,opName,argl,argModeSetList)
+ -- If this is a type producing form, then we don't want
+ -- to store the representation object in the environment.
+ -- Rather, we want to record the reified canonical form.
+ if ms is [m] and (m in '((Mode) (Domain) (SubDomain (Domain))) or
isCategoryForm(m,$e))
+ then putValue(t,objNew(devaluate objValUnwrap getValue t, m))
-- given no target or package calling, force integer constants to
-- belong to tightest possible subdomain
Index: i-eval.boot
===================================================================
--- i-eval.boot (Revision 364)
+++ i-eval.boot (Arbeitskopie)
@@ -145,10 +145,22 @@
op='Record =>
[op,:[['_:,sel,evaluateType type] for ['_:,sel,type] in argl]]
op='Enumeration => form
- evaluateType1 form
+ evaluateFormAsType form
constructor? form =>
ATOM form => evaluateType [form]
throwEvalTypeMsg("S2IE0003",[form,form])
+ evaluateFormAsType form
+
+++ `form' used in a context where a type (domain or category) is
+++ expected. Attempt to fully evaluate it. Error if the resulting
+++ value is not a type. When successful, the result is the reified
+++ canonical form of the type.
+evaluateFormAsType form ==
+ form is [op,:args] and constructor? op => evaluateType1 form
+ t := mkAtree form
+ -- ??? Maybe we should be more careful about generalized types.
+ bottomUp t is [m] and (m in '((Mode) (Domain) (SubDomain (Domain))) or
isCategoryForm(m,$e)) =>
+ objVal getValue t
throwEvalTypeMsg("S2IE0004",[form])
evaluateType1 form ==
Index: i-spec1.boot
===================================================================
--- i-spec1.boot (Revision 364)
+++ i-spec1.boot (Arbeitskopie)
@@ -1216,7 +1216,8 @@
get(form,'value,$InteractiveFrame) or _
(PAIRP($env) and get(form,'value,$env)) or _
(PAIRP($e) and get(form,'value,$e)))) and
- objMode(val) in '((Domain) (SubDomain (Domain))) =>
+ ((m := objMode(val)) in '((Domain) (SubDomain (Domain)))
+ or categoryForm? m) =>
objValUnwrap(val)
nil
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
open-axiom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel