6 ms·
http://www.lysator.liu.se/c/bwk-on-pascal.html http://www.lysator.liu.se/c/bwk-on-pascal.html
by tjr 5y ago
http://www.lysator.liu.se/c/bwk-on-pascal.html http://www.lysator.liu.se/c/bwk-on-pascal.html
- fayten 5y agoThe contents of that post have not been relevant for decades. I would recommend giving Free Pascal a whirl if you haven't. FPC can even compile to JavaScript and it works with WebGL https://github.com/genericptr/Pas2JS-WebGL#pas2js-webgl https://github.com/genericptr/Pas2JS-WebGL#pas2js-webgl
- Turing_Machine 5y ago> The contents of that post have not been relevant for decades. But decades ago is precisely the timeframe we're talking about here. Pascal lost to C for the reasons Kernighan mentions (among others), which is the question the OP was asking.
- pjmlp 5y agoYou mean features that were actually available in Pascal dialects, during the days when C outside UNIX was based on K&R C dialects like Small-C? Also considering that most of the complains were fixed in Modula-2, made available initially in 1978.
- ncmncm 5y agoMost people at the time had never heard of Modula-2, and in any case had no ready access to a compiler for Modula-2. You have already had pointed out that the dialects you promote were all mutually incompatible, with no preprocessor to help paper over differences. Anybody wanting to write portable code was stuck. And, the article was about Pascal, not about Modula-2. Are you wishing he had also written an article about Modula-2 that you could also critize, maybe for not being about Modula-3 or Oberon instead?
- fayten 5y agoI'm not sure Pascal entirely lost due to just C. Borland's Turbo Pascal was quite popular and was broadly used in the mid 80s. Apple even used their own Object Pascal variant through-out the 80s. Pascal was primarily used for application development and for this case it was leagues ahead of C and C++. Turbo Pascal thrived up until Delphi was released in 1995, which then became the new lead Pascal. Unfortunately, Delphi would come to face it's killer within a year. When Java came out in 1996 it became an overnight juggernaut in application development. Java had a ton of hype when it was still in beta in 1995 and TIME magazine even listed it as one of the best products of the year--when it wasn't even released yet. Microsoft poached Anders Hejlsberg, the primary language designer of Turbo Pascal and Delphi, from Borland in 1996 to have him work J++ their variant of Java. J++ followed the Sun Java spec with a few deviations, but it was just another testament to how quickly Java was taking over. Borland was now competing with something that was free and they needed to pivot and well...they didn't. Random articles for further reading: https://en.wikipedia.org/wiki/Anders_Hejlsberg https://en.wikipedia.org/wiki/Anders_Hejlsberg https://en.wikipedia.org/wiki/Visual_J%2B%2B https://en.wikipedia.org/wiki/Visual_J%2B%2B http://content.time.com/time/subscriber/article/0,33009,983903,00.html http://content.time.com/time/subscriber/article/0,33009,9839... https://en.wikipedia.org/wiki/Turbo_Pascal https://en.wikipedia.org/wiki/Turbo_Pascal https://stackoverflow.com/questions/8460037/list-of-delphi-language-features-and-version-in-which-they-were-introduced-depre https://stackoverflow.com/questions/8460037/list-of-delphi-l...
- Turing_Machine 5y ago> I'm not sure Pascal entirely lost due to just C. Borland's Turbo Pascal was quite popular Look at which one is being used to this day to write essentially every modern operating system, and even the interpreters and compilers for other languages. JavaScript engines are written in C, not Pascal. I think it obviously did lose, though judging from the moderation it clearly still has some fanatical followers. Both Turbo Pascal and Object Pascal had so many extra non-standard and un-Pascal-like features that they were barely even the same language. As I mentioned in another comment, allowing you to write bare assembly language inline wasn't exactly a feature of the original Wirth Pascal. The analogy I used at the time was that (Wirth) Pascal was like a pair of blunt-pointed kindergarten scissors, while C was more like a chainsaw. Borland added enough non-standard features to make it more like maybe a kitchen knife, but in the long run that still wasn't enough.
- guiraldelli 5y agoAlthough 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)#Language_constructs https://en.m.wikipedia.org/wiki/Pascal_(programming_language...
- kortex 5y agoRe 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.
- Tozen 5y agoSome very good points.
- pjmlp 5y agoUNIX propaganda that was already out of date when it was published.
- davidhbolton 5y agoI always think it ironic that the C order of variable declaration prevailed for so many years (C++, C#, Java) yet in recent times several newer languages have discovered that the Pascal declaration order is handy for compiler type inference. var age : integer; pascal var age int - Go var age : int - Swift var age = 52; - Dart var age: Int = 10 Kotlin
- pjmlp 5y agoIndeed, it is some kind of sweet revenge that most modern languages have reverted back to Pascal style of programming.
- Koshkin 5y agoWhile I appreciate the increased readability, I kind of like C being economical, in that it does not need all those pesky 'var', 'fn', etc. (On the other hand, I think C creators may have gone a bit too far with this when they decided that overloading the keyword 'static' was a good idea.)
- pjmlp 5y agoIt is so complex that people came up with tooling to actually understand when some devs go wild, https://cdecl.org/ https://cdecl.org/ Also the main reason behind the religous war in C++ of west const versus east const. Microsoft now got a couple of top devs on their C++ team that are on east const, so while we have about 25 years of Microsoft documentation, code samples and libraries using west const, the C++/WinRT team is now pushing for east const everywhere.
- cyber_kinetist 5y agoOh, and don’t forget the eternal holy war for the right asterisk/ampersand location! (SomeType* ptr vs. SomeType *ptr) https://stackoverflow.com/questions/2660633/declaring-pointers-asterisk-on-the-left-or-right-of-the-space-between-the-type https://stackoverflow.com/questions/2660633/declaring-pointe...
- igouy 5y agoIf this is an exercise in reading comprehension I suppose we should begin by trying to identify the author's purpose — persuade, inform, or entertain — and distinguish between facts and opinions.