DomA( a: List Integer ):with {...} == add {...}

a: List Integer := [ 1, 2, 3 ];
R == DomA( a );
a . 2 := 300;
S == DomA( a );

a still refers to the same memory location, but it is different. Would R equal S?

Well, here I would comment the following.

a.2 := 300

is the same as

set!(a, 2, 300)

Everyone sees the exclamation mark? This exclamation mark is a _convention_ in Aldor to say that a function is destructive, ie it destroys one of its parameters.

And the comment is: If you use destructive functions, you might earn speed but you have to take care of correctness yourself. Basically, by using destructive functions one can introduce as nasty things as one wants. The above code snippet is just such an example of such a nasty thing.


Ralf


_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to