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

Edit detail for SandBox Cast revision 1 of 2

1 2
Editor:
Time: 2007/11/18 17:51:58 GMT-8
Note:

changed:
-
This is an example of using 'pretend' to perform a type
unsafe operation.

\begin{spad}
)abbrev package CAST cast
cast(): exports == implementation where

  exports == with

    cast1: Integer -> Float

  implementation == add

    cast1(i:Integer):Float ==
      j:Float := (i pretend Float)
\end{spad}

This command causes a "memory may be damaged error"::

  !\begin{axiom}
  cast1(1)$CAST
  \end{axiom}

\begin{aldor}[casta]
#include "axiom"
cast2(i: Integer): Float == {
      j:Float := (i pretend Float)
}
\end{aldor}

This command also causes a "memory may be damaged error"::

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


This is an example of using pretend to perform a type unsafe operation.

spad
)abbrev package CAST cast
cast(): exports == implementation where
exports == with
cast1: Integer -> Float
implementation == add
cast1(i:Integer):Float == j:Float := (i pretend Float)
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/76482798552469661-25px001.spad using old
      system compiler.
   CAST abbreviates package cast 
------------------------------------------------------------------------
   initializing NRLIB CAST for cast 
   compiling into NRLIB CAST 
   compiling exported cast1 : Integer -> Float
      CAST;cast1;IF;1 is replaced by LETji 
Time: 0.04 SEC.
(time taken in buildFunctor: 0)
;;; *** |cast| REDEFINED
;;; *** |cast| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor cast Time: 0.04 seconds
finalizing NRLIB CAST Processing cast for Browser database: --->-->cast((cast1 ((Float) (Integer)))): Not documented!!!! --->-->cast(constructor): Not documented!!!! --->-->cast(): Missing Description ; compiling file "/var/zope2/var/LatexWiki/CAST.NRLIB/CAST.lsp" (written 13 OCT 2009 04:53:43 PM): ; compiling (/VERSIONCHECK 2) ; compiling (PUT (QUOTE |CAST;cast1;IF;1|) ...) ; compiling (DEFUN |CAST;cast1;IF;1| ...) ; compiling (DEFUN |cast| ...) ; compiling (DEFUN |cast;| ...) ; compiling (MAKEPROP (QUOTE |cast|) ...) ; compiling (MAKEPROP (QUOTE |cast|) ...)
; /var/zope2/var/LatexWiki/CAST.NRLIB/CAST.fasl written ; compilation finished in 0:00:00.048 ------------------------------------------------------------------------ cast is now explicitly exposed in frame initial cast will be automatically loaded when needed from /var/zope2/var/LatexWiki/CAST.NRLIB/CAST

This command causes a "memory may be damaged error":

  \begin{axiom}
  cast1(1)$CAST
  \end{axiom}

aldor
#include "axiom"
cast2(i: Integer): Float == {
      j:Float := (i pretend Float)
}
aldor
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/casta.as using AXIOM-XL compiler and 
      options 
-O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra
      Use the system command )set compiler args to change these 
      options.
   Compiling Lisp source code from file ./casta.lsp
   Issuing )library command for casta
   Reading /var/zope2/var/LatexWiki/casta.asy

This command also causes a "memory may be damaged error":

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