> not just the usual errors, inaccuracies and "common deviations" that you find in every C compiler, and that force you to secure libraries with #ifdefs.
And extension keywords for microcontrollers specific features, intrisics for CPU instructions, DSP specific capabilities,....
Yeah I am already used that what goes for Pascal gets another weigth when placed against C.
And while the discussions keep going around Pascal and its extensions, there is this little detail of Modula-2 being released in 1978, where all the issues with Pascal (as originally designed by Wirth) for systems programming were already fixed.
Where Apple II and III Pascal was based on UCSD Pascal, Lisa Pascal was apparently directly based on Wirth's P4 compiler, not on UCSD Pascal. See page 4.
> Therefore, Lisa Pascal lasted from 1981 to 1986, an eternity in the field of microcomputer languages.
;-)
> Tho (sic) Pascal will have the support of a small but vocal minority at Apple, C/C++ will be the dominant language for Apple and outsiders for the next decade.
RIP Pascal, you will not be forgotten - and you will live on as Delphi.
Two big extensions to original/Wirth Pascal that enabled Pascal to work well for the Lisa and subsequent systems were units (separate compilation modules that could be imported/referenced using the USES statement) and an early version of Object Pascal known as Clascal.
I'm not sure that Pascal's evolution from Wirth Pascal to UCSD/Lisa/Turbo/etc. Pascal to Object Pascal and Delphi is something to complain about, any more than we'd complain about C evolving from K&R to C89/.../C23 and to C++ (and its various versions.) Pascal is still a capable and relatively compact language.
Regarding the @ operator and type casts, you could often hack something similar in standard Pascal implementations using case variant records, though I think it was technically undefined behavior in the standard. @ and type casts just make it an official feature with simpler syntax.
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.
The USCD P-System spec is here, for anyone interested:
http://pascal.hansotten.com/uploads/ucsd/ucsd/UCSD_PASCAL_II...