login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #206 Interpreter code generation failed for function returning a Type revision 1 of 11

1 2 3 4 5 6 7 8 9 10 11
Editor:
Time: 2007/11/17 22:08:25 GMT-8
Note:

changed:
-
This function should return a type that depends on a
parameter:
\begin{axiom}
tt:INT->Type
tt(x)== (x=0 => Integer; Float)
tt(1)
\end{axiom}

Here is the same function in SPAD:
\begin{spad}
)abbrev package TT testtype
testtype(): exports == implementation where
  exports == with
    tt1: (Integer) -> Type
  implementation == add
    tt1(x) ==
      x=0 => Integer
      Float
\end{spad}

Calling this function like this::

  !\begin{axiom}
  tt1(1)
  \end{axiom}

causes Axiom to crash::

  (1) -> tt1(1)

   >> System error:
   Caught fatal error [memory may be damaged]

But this works using Aldor! :-)
\begin{aldor}
#include "axiom.as";
testtype2(): with {
    tt2: (Integer) -> Type;
} == add {
    tt2(x:Integer):Type == {
      x=0 => Integer;
      Float;
      }
    }
\end{aldor}

\begin{axiom}
tt2(1)
tt2(0)
\end{axiom}


Submitted by : (unknown) at: 2007-11-17T22:08:25-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

This function should return a type that depends on a parameter:

axiom
tt:INT->Type
Type: Void
axiom
tt(x)== (x=0 => Integer; Float)
Type: Void
axiom
tt(1) Internal Error Interpreter code generation failed for expression (IF (= |#1| 0) |Integer| |Float|)

Here is the same function in SPAD:

spad
)abbrev package TT testtype testtype(): exports == implementation where exports == with tt1: (Integer) -> Type implementation == add tt1(x) == x=0 => Integer Float
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/8965653050310018446-25px002.spad using 
      old system compiler.
   TT abbreviates package testtype 
------------------------------------------------------------------------
   initializing NRLIB TT for testtype 
   compiling into NRLIB TT 
   compiling exported tt1 : Integer -> Type
Time: 0.06 SEC.
(time taken in buildFunctor:  0)
;;;     ***       |testtype| REDEFINED
;;;     ***       |testtype| REDEFINED
Time: 0 SEC.
   Cumulative Statistics for Constructor testtype
      Time: 0.06 seconds
   finalizing NRLIB TT 
   Processing testtype for Browser database:
--->-->testtype((tt1 ((Type) (Integer)))): Not documented!!!!
--->-->testtype(constructor): Not documented!!!!
--->-->testtype(): Missing Description
------------------------------------------------------------------------
   testtype is now explicitly exposed in frame initial 
   testtype will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/TT.NRLIB/code

Calling this function like this:

  \begin{axiom}
  tt1(1)
  \end{axiom}

causes Axiom to crash:

  (1) -> tt1(1)

   >> System error:
   Caught fatal error [memory may be damaged]

But this works using Aldor! :-)

aldor
#include "axiom.as"; testtype2(): with { tt2: (Integer) -> Type; } == add { tt2(x:Integer):Type == { x=0 => Integer; Float; } }
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/7383689924623811223-25px003.as using 
      AXIOM-XL compiler and options 
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
#1 (Warning) Deprecated message prefix: use `ALDOR_' instead of `_AXL'
"/var/zope2/var/LatexWiki/7383689924623811223-25px003.as", line 5: 
    tt2(x:Integer):Type == {
........^
[L5 C9] #2 (Warning) Function returns a domain that might not be constant (which may cause problems if it is used in a dependent type).
   Compiling Lisp source code from file 
      ./7383689924623811223-25px003.lsp
   Issuing )library command for 7383689924623811223-25px003
   Reading /var/zope2/var/LatexWiki/7383689924623811223-25px003.asy
   testtype2 is now explicitly exposed in frame initial 
   testtype2 will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/7383689924623811223-25px003

axiom
tt2(1)
LatexWiki Image(1)
Type: Type
axiom
tt2(0)
LatexWiki Image(2)
Type: Type