[Aldor-l] Should this "parser" work?
Ralf Hemmecke
ralf at hemmecke.de
Wed Oct 25 06:59:45 EDT 2006
>> 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.
I think it is somewhere in the AUG that says, that Aldor passes pointers
if the object does not fit into the size of a pointer.
Usually, If SomeThing is Character, MachineInteger, Byte, and some other
"small" types, Aldor passes a copy of the object (not a copy of the
pointer to the object).
If SomeThing is SingleFloat, DoubleFloat, String, Array(T), Record(...),
then Aldor passes a pointer to the structures and you can do any
destructive operation you like inside the function. It will effect the
structure you pass (as a pointer) to the function.
Note perhaps that, if you say
af: Array SingleFloat := [1.0, 2.1];
You actually get an array of pointers in memory where the pointers point
to 1.0 and 2.1 (which are stored as some 6 or 8 byte (don't know)
structure).
But also look up the documentation of PackedPrimitiveArray and
PackableType in LibAldor.
Ralf
More information about the Aldor-l
mailing list