I believe with (unsafe, packed) case variant records you could often get the address of anything that was allocated on the heap:
...
type Addr = packed record
case Integer of
0: (addr: Integer);
1: (ptr: ^Something);
end;
...
function printAddressOf(somethingPtr);
var somethingPtr: ^Something;
ptr: Addr;
begin
ptr.ptr = somethingPtr; { copy its pointer }
writeln('Something was allocated at ', ptr.addr);
end;
(Apologies for any errors - I don't write Pascal very often.)This obviously relies on implementation-specific behavior such as integers and pointers being the same size.
With this sort of trickery you can do all sorts of things including pointer arithmetic, custom memory allocators, garbage collectors, (unsafe) type casts, etc..
From which I suppose we can conclude that C/C++ without undefined behavior has been found to be unsuitable for systems programming. Or that systems programs tend to be non-portable by nature.
Perhaps a more charitable conclusion is that languages like Wirth Pascal and K&R C (for example) contain loopholes and unsafe/technically undefined behavior which can be useful for systems programming but problematic for memory safety and security/reliability.
Sadly Pascal standardization seems to have stalled after ISO Extended Pascal in 1991, while C is still evolving into C23.
Another conclusion might be that Apple started with UCSD Pascal (which was available for the Apple II and already included extensions to standard Pascal) and that they thought that certain extensions were useful even if they weren't technically necessary.
Clearly the Lisa didn't need Clascal or Object Pascal (the Macintosh didn't require them), but they provide advantages in terms of conciseness, modularity, reusability, etc..
cool!
> So far I only saw two of the ~350 Lisa OS source files looking like Clascal (both from the Lisa toolkit)
Have you looked for instances of SELF in the Lisa Toolkit and app sources?
Anything that is SELF.foo is a Clascal instance variable or instance method reference in a method. You can also use with SELF do... to make it more implicit like C++ or Java.
Also look for METHODS OF, SUPERSELF, CREATE, etc..
It's actually not a surprise I see some Clascal files in the Lisa OS tree since LIBTK in LISA_OS/LIBS is apparently just a copy of the Lisa Toolkit.