|
From: | Ralf Hemmecke |
Subject: | [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains. |
Date: | Tue, 16 May 2006 15:08:16 +0200 |
User-agent: | Thunderbird 1.5.0.2 (X11/20060420) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |