2 ms·
Wirth's Pascal as described in User Manual and Report is nearly impossible to write non-trivial programs in. I know, I tried. It required a lot of extensions to
by WalterBright 6y ago
Wirth's Pascal as described in User Manual and Report is nearly impossible to write non-trivial programs in. I know, I tried. It required a lot of extensions to become usable.
In 1982 or so a friend loaned me his copy of K+R, I read it, and was instantly hooked. Never wrote another line of Pascal. I had written a lot of PDP-11 assembler at the time, and C's PDP-11 heritage made it very easy to pick up C. I saw how the PDP-11's semantics mapped right on to C.
But some good came out of my experience with Pascal. D's nested functions are inspired by Pascal's nested functions. Simple and easy, including the ability to reach back on the stack and access the callers's variables (all the way up to main()).
C should have had nested functions.
- badsectoracula 6y agoAnd typesafe enums and sets of said enums and ranges of ints and enums and arrays addressable by said ranges and the ability to pass values by reference to functions :-P
- rootbear 6y agoAgree on nested functions. Gcc has them as an extension but the last time I looked, clang did not. A pity.
- notacoward 6y agoThere are also some pitfalls in gcc's implementation. On one project we found that nested functions used as callbacks didn't play well with green threads, and it was a pain to deal with.