[Top][All Lists]

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

[Axiom-developer] Re: [Aldor-l] RE: Axiom domains and Aldor return types

From: Ralf Hemmecke
Subject: [Axiom-developer] Re: [Aldor-l] RE: Axiom domains and Aldor return types
Date: Wed, 12 Jan 2005 22:41:12 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041202)

Oops, sorry that I have not read the documentation of Any.
I had a look at Any now. Well, from that I just got the feeling that a programmer should never use Any if there are better types around (and often there are). Any seems to be connected to the interpreter. Since everything must have a type and the interpreter cannot figure out something reasonable, it falls back to Any.

I'd rather be happy if the interpreter is clearly separated from the compiler.

The interpreter is for working with Axiom, so it could help the (lazy) user and find/guesss appropriate types for him/her. However there should be NO guessing when it comes to writing new library code.

Looking at the code of Any reminds me much of the things I have suggested here
The code is in*.as.

The problem I still have with any is that it says

     Rep := Record(dm: SExpression, ob: None)
     dom x      ==

which looks very near to some LISP thing.
So I can ask for the domain a: Any by calling dom(a). Then I will get an SExpression which makes me feel lost.

Unfortunately, I have no runnig Axiom at the moment :-(
And I cannot compile axim--main--1 (bfd.h is missing and I have no idea what to install).

So I tested on

i: Integer := 1
  Type: Integer

a: Any := i::Any
  Type: Integer  <----- very interesting!!!

dom a
   Type: SExpression
obj a
  Type: None

j: Integer := a :: Integer
  Type: Integer

It seems the interpreter is quite smart.

s: String := "I am a string"
  Type: String

b: Any := s::Any
  Type: String

dom b
  Type: SExpression?

obj b
  Type: None

k: Integer := b :: Integer
   Cannot convert from type Any to Integer for value
   "I am a string"

This Error is OK. And I think for manually working with Axiom, one just needs to type dom(...) and then coerce to the now known type. But how to use Any in a program is totally unclear to me. I have no idea to get the domain back from the SExpression.


reply via email to

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