Hacker News new | ask | show | jobs
by guiraldelli 1738 days ago
Although an interesting reading from Kernighan in the temporal and industry context (let us remember he worked for years building UNIX, the greatest reason C still survives, and published the reference C book), it is also interesting to see that at least six of his arguments against Pascal (namely, 1, 2*, 5, 6, 8*, 9, where only part of the arguments 2 and 8 should be considered) are actually considered best practices nowadays, and are related to type safety and functional programming.

I am not a Pascal expert, but I believe that arguments 3, 4, 7 and 8 are not valid any more, possibly they were not even valid a decade later, which would invalidate the whole essay.

And some of the "advantages" of C over Pascal, presented by Kernighan, are exactly the origin of many CVEs we have nowadays, such as unbounded arrays and unverified casting of types.

I really like Kernighan's code and texts, but it is important to remember he is really biased in this text, and hasn't provided any of the advantages of Pascal over C, except it is easier to learn.

I won't promote Pascal, but one can see that a language two years older than C has some language constructs [1] not seen even on modern programming languages! Kernighan, though, purposely left it all out of his evaluation.

[1]: https://en.m.wikipedia.org/wiki/Pascal_(programming_language...

2 comments

Re 1/2 - I don't follow? The criticism is not against fixed array types or statics. It's that it has those traits and there is no escape hatch. Functional languages with strong type systems are flexible enough to operate over arrays/strings generically. And static/global is absolutely used. The difference is nowadays there are stronger controls to access (e.g. rust's lifetimes and borrow checking).

I don't know much about Pascal but it sounds really hard to do things which aren't supported by the development environment.

Some very good points.