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

Christian Aistleitner tmgisi at gmx.at
Wed Oct 25 05:34:03 EDT 2006


Hello,

On Tue, 24 Oct 2006 10:36:15 +0200, Martin Rubey  
<martin.rubey at univie.ac.at> wrote:

> "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

Dom is a pointer to some memory location. Yes.

> set passes a copy of the pointer to Dom.

A copy of the pointer?
So both, the copied pointer and the original pointer point to the same  
memory location?

What's the reason of the copying then in first place?

I obviously misunderstood, as in the next paragraph, you want something  
different:

> Thus, if I have some function
>
> f(i: SomeThing, j: AnotherThing): ThatThing == {
>         ...
>         i := MyThing;
>         ...
>         j.1 := MyOtherThing;
>         ...
> }
>
> which I call with
>
> f(x, y)
>
> [...]


> Also y is copied, and passed to f.

y is copied? Or a new pointer is created, pointing to the same location y  
points to?

> Although f doesn't modify y, this time, f
> does modify the contents of y.

y itself is not copied, as can be seen in my previous mail.
Assume, you meant j points to the same location, y points at.
But as y and j both point to the same location, how could
   j.1 := ...
not affect y.1 (given the set! operation works in the usual way)?

--
Kind regards,
Christian



More information about the Aldor-l mailing list