Unexpected aliasing
Bastiaan Veelo
Bastiaan at Veelo.net
Tue Nov 12 09:28:51 UTC 2019
On Tuesday, 12 November 2019 at 08:15:20 UTC, Basile B. wrote:
>
> I'm curious to know what is the equivalent in Pascal that your
> transpiler fails to translate since Pascal records don't have
> constructors at all. Maybe you used an old school 'Object' ?
Note that Extended Pascal is not exactly Pascal. An example:
TYPE Ints(upperBound) = ARRAY [1 .. upperBound] of Integer;
MyRecord = RECORD
integers : Ints(5);
END;
SchematicRecord(num) = RECORD
integers : Ints(num);
END;
IntsPtr = ^Ints;
PROCEDURE myProcedure(PROTECTED VAR someArr : Ints);
BEGIN
writeln(someArr.upperBound);
END;
PROCEDURE proc;
VAR dynamicInts : IntsPtr;
rec : MyRecord;
BEGIN
dynamicInts = new(10);
myProcedure(dynamicInts^);
myProcedure(rec.integers);
END;
In this case, only the upper bound of Ints is parameterized, but
the lower bound could be parameterized as well. Records can also
be schematized. Procedure arguments can take schemas that are
undiscriminated, they carry their schemaparameters as properties.
Bastiaan.
More information about the Digitalmars-d-learn
mailing list