axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Axiom-developer] types as values, and type internals


From: Page, Bill
Subject: RE: [Axiom-developer] types as values, and type internals
Date: Thu, 29 Sep 2005 03:36:45 -0400

Peter,

I am quite interested in your ideas about providing
something equivalent to java.lang.reflect in Aldor and
Axoim. I think this might also be useful to solve the
problem with an undefined function |domain| which appears
when writing for example:

(1) ->  (Integer,Float)

in the Axiom interpreter. If I rename your AldorDomain to
just Domain then the patches below the Tuple of Domains
prints properly, although there are still other problems,
e.g. selection from the Tuple causes a seg fault.

I wonder if the the Rep == Type really makes sense?

On Monday, September 26, 2005 4:41 PM Peter Broadbery wrote:

> 
> As usual, should have done a bit more testing; use the
> attached domain2.as - it makes map work a bit better.
> 
> a := map(theIntegerType(), theIntegerType())
> lookup(theIntegerType(), "-", a);
> 
> works, but axiom will not display the object returned by
> lookup - it's expecting an SExpression (ie a list of lispy
> values), and we're feeding it a more complex structure.
> 

The stuff in interop.boot seems very obscure to me but
I am gradually absorbing a little.

Here's a simple patch that actually prints domain names by
calling devaluate() instead of manipulating the domain as
a record structure. There must also be something subtley
wrong with Rep2?

Patch follows:

--------

address@hidden page]$ diff -au domain2.as.orig domain2.as.new
--- domain2.as.orig     2005-09-29 02:02:13.000000000 -0500
+++ domain2.as.new      2005-09-29 02:02:34.000000000 -0500
@@ -1,6 +1,6 @@
 #include "axiom.as"

-AldorDomain: BasicType with {
+AldorDomain: SetCategory with {
        make: (T: BasicType) -> %;

        theIntegerType: () -> %;
@@ -17,8 +17,8 @@

 } == add {
        import {
-               BOOT_:_:DNameToSExpr: SExpression -> SExpression;
                BOOT_:_:hashString: SExpression -> SExpression;
+                BOOT_:_:devaluate: SExpression -> SExpression;
        } from Foreign Lisp;

        Rep  ==> Type;
@@ -51,12 +51,12 @@

        coerce(t: %): OutputForm == {
                import from String;
-               "<SomeType>"::OutputForm
+               name(t)::OutputForm
        }

        name(t: %): SExpression == {
-               dom := t pretend Rep2;
-               axiomName((dom.v.domName)(dom.o))
+                dom := t pretend SExpression;
+                devaluate(dom);
        }

        -- nb: cf. interop.boot, basicLookup
@@ -81,9 +81,9 @@
                integer((dom.v.hashCode)(dom.o))
        }

-       local axiomName(s: SExpression): SExpression == {
-               BOOT_:_:DNameToSExpr(s);
-       }
+        local devaluate(s: SExpression): SExpression == {
+                BOOT_:_:devaluate(s);
+        }

        local hashString(s: SExpression): SExpression == {
                BOOT_:_:hashString(s);

-------

Regards,
Bill Page.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]