[Aldor-l] exports and constants

Ralf Hemmecke ralf at hemmecke.de
Mon Jul 24 17:15:02 EDT 2006


> My understanding as show by the example in my previous post.
> 
> Dynamic type :=
> in the scope a variable can change type
> ex :
> a := 10
> a := "ten"
> is ok
> 
> Static type :=
> Variable can not change type
> a := 10
> a := 20
> but not
> a := "thirty"

In Aldor you cannot have a: Integer and a: String in the same scope if 
they are variables. Constants are different.

---BEGIN aaa11.as
#include "aldor"
#include "aldorio"
a: Integer == 1;
a: String == "b";
foo: Integer -> Integer == (i: Integer): Integer +-> i;
foo: String  -> String  == (i: String ): String +-> i + i;
stdout << (a at Integer) << newline;
stdout << (a at String ) << newline;
stdout << (foo 3  ) << newline;
stdout << (foo "a") << newline;
---END aaa11.as

 >aldor -grun -laldor aaa11.as
1
b
3
aa

Ralf



More information about the Aldor-l mailing list