[Aldor-l] Should this "parser" work?

Martin Rubey martin.rubey at univie.ac.at
Tue Oct 24 04:36:15 EDT 2006


"Christian Aistleitner" <tmgisi at gmx.at> writes:

> >> You probably mean “some copy/reference of/to the domain”. But I do not
> >> think, something like that happens.

Yes.

I copy the Quotation here for easier reading:

 Fortran-77 has a fixed and relatively small set of data types, passes all
 subprogram parameters by reference (i.e. it passes a pointer to the data
 rather than a copy of the data). Aldor, on other hand, has a rich and
 extensible type system, and in general will pass copies of subprogram data (at
 least in simple cases).

> I think, it does not apply.

> dump( Dom );   -- print the magic number
> 
> set( Dom, 4 ); -- set the magic number to 4
> 
> dump( Dom );   -- print the magic number
> 
> If you are right, how can you explain this output
> ____________________________________________
> tmgisi at spencer

> Dom   0
> Dom   4
> 
> According to your interpretation, within set, D is a copy of Dom. 

No, not really. What I thought is that 

Dom really is a pointer to some memory location

set passes a copy of the pointer to Dom.



Thus, if I have some function

f(i: SomeThing, j: AnotherThing): ThatThing == {
        ...
        i := MyThing;
        ...
        j.1 := MyOtherThing;
        ...
}
       

which I call with

f(x, y)

then x is copied, passed to f. Although f modifies i, it does not modify x.
Also y is copied, and passed to f. Although f doesn't modify y, this time, f
does modify the contents of y.

I should stress that I'm only guessing. I never looked into a compiler, nor
into compiled code. Thus, I'm rather asking for corrections, not stating that I
think that my reasoning would be correct...

Martin





More information about the Aldor-l mailing list