3 ms·
Safer yes (pointers were less ubiquitous and much safer) and it had other type-safety features like subranges (~refinement types), sets, type-safe enums (though
by masklinn 9y ago
Safer yes (pointers were less ubiquitous and much safer) and it had other type-safety features like subranges (~refinement types), sets, type-safe enums (though not proper sum types), …
It had a raft of issues though, chiefly a lack of dynamically sized arrays and strings ("pascal strings" combine a static maximum size of no more than 255 with a single-byte actual-length prefix, IIRC all on the stack) or rudimentary dependent typing making generic processing of these extremely difficult[0], no ability to break (out of loops) or early-return, undefined order of evaluation of boolean expressions (and/or), … Kernighan actually wrote an entire "Why Pascal is Not My Favorite Programming Language" essay in '81
More modern evolution have related/fixed some of these since, not necessarily in great ways (freepascal's "String" can use one of 3 different string implementations depending on compiler settings & active pragmas[1], and that's a small subsets of the actual stable of string implementation available)
[0] outside of builtins (which weren't limited to the language's "user" semantics much like Go today) you'd need an implementation for each static length of array/string
[1] http://wiki.freepascal.org/Character_and_string_types#String http://wiki.freepascal.org/Character_and_string_types#String