On Wed, Jul 16, 2008 at 10:25 PM, Yixin Cao
<[EMAIL PROTECTED]> wrote:
> Howdy,
>
>
> (1) -> a:INT
>                                                                    Type:
> Void
> (2) -> a:=1.1
>
>    Cannot convert right-hand side of assignment
>    1.1
>
>       to an object of the type Integer of the left-hand side.
> (2) -> b:=2
>
>    (2)  2
>                                                         Type:
> PositiveInteger
> (7) -> b:=%i
>
>    (7)  %i
>                                                         Type: Complex
> Integer
>
>
> This is a strange behavior when I am new to the OpenAxiom system. A variable
> declared with some type
> will never change, this is clear. But but the variables without type
> declaration can change type at any time
> is a little confusing.
>
> I know this has reason rooted in i-object.boot, and the $e of interpreter
> will show this:

The `reason' is not rooted in the code -- the code only implements a
reason (i.e. an intent).

The short answer is: a variable declaration is not the same as binding
a symbol to a value.

As you know by now, there is a difference between a variable
declaration and an `untyped'
variable definition.

A variable declaration is a promise that a variable will always
designate an object
whose value belongs to the declared type.  And that promise cannot be broken.

An untyped variable definition introduces an a symbol in the
evaluation environment to
designate a value -- the symbol itself is never declared of being of a
specific type.
Since the since is no declared, there is no violation of promise.  In
fact, this is
how people do `symbolic manipulation'.

>
> (8) -> SAY(_$e$Lisp)$Lisp
> ((((b (value (Complex (Integer)) WRAPPED 0 . 1)) (% (value (Complex
> (Integer)) WRAPPED 0 . 1)) (a (mode Integer)))))

I would have said

    currentEnv()

-------------------------------------------------------------------------
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
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to