[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] functional type system using pointer comparisons to ch
From: |
Christian Aistleitner |
Subject: |
[Axiom-developer] functional type system using pointer comparisons to check equality [was: Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains.] |
Date: |
Tue, 16 May 2006 16:56:44 +0200 |
User-agent: |
Opera Mail/9.00 (Linux) |
Hello,
On Tue, 16 May 2006 15:08:16 +0200, Ralf Hemmecke <address@hidden> wrote:
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,
Yes.
ie it destroys one of its parameters.
No. It may destroy _all_ of its parameters. But thats not the point.
Since it is hard -- or rather impossible -- for a developer to deceide
whether or not a value he returns will be or has been used in a type
constructing function, you'd practically forbid using destructive
functions at all.
You'd not even be allowed to act destructivly on a value you just copied:
SomeDom: with {
CopyableType;
...
} == add {
copy( a: % ): % == {
local copiedValue: %;
...
copiedValue := ...;
...
assert( hasBeenProperlyCopied $ ProperlyCopiedHelperDomain( a,
copiedValue ) );
copiedValue;
}
...
}
local a: SomeDom := ...
local b: SomeDom := copy a;
destructiveFunction!( b ); -- b has already been used in via copiedValue
in ProperlyCopiedHelperDomain( a, copiedValue ).
So practically no destructive functions...
I wouldn't want to have a functional-type system performing equality
checks by comparing pointers.
Besides, huge Integers representing the same number most likely do not
share the same memory.
Besides, Lists of the same integers most likely do not share the same
memory.
Most "elements of domains", which represent the same value most likely do
not share memory. However, they can be used as parameters to domain
constructing functions. What would be the worth of "functionality" if it
stops there?
--
Kind regards,
Christian
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., (continued)
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Christian Aistleitner, 2006/05/17
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Martin Rubey, 2006/05/17
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Christian Aistleitner, 2006/05/17
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Stephen Watt, 2006/05/17
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Christian Aistleitner, 2006/05/18
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Christian Aistleitner, 2006/05/15
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Gabriel Dos Reis, 2006/05/15
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Ralf Hemmecke, 2006/05/15
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Christian Aistleitner, 2006/05/16
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Ralf Hemmecke, 2006/05/16
- [Axiom-developer] functional type system using pointer comparisons to check equality [was: Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains.],
Christian Aistleitner <=
- [Axiom-developer] Re: [Aldor-l] [Axiom-math] Are Fraction and Complex domains., Christian Aistleitner, 2006/05/16