Live data from Hacker News

Why use Pascal?

castle-engine.io

151–160 of 516 posts

Re: Why use Pascal?

#151

Earlier quoted context omitted.

Every so often a thread pops up about Turbo Pascal and I'm astonished as to how nice an IDE you could fit onto a 64K CP/M system. (See also comments above/below.)

Oh, it was very very nice. I still miss it today sometimes. Here are a few highlights: - Pressing F1 gave you reliably context sensitive help and the help content was really well put together. - The debugger was great and was basically what we now know from Eclipse or IntelliJ and completely not like gdb. It had the same keyboard shortcuts for stepping as IntelliJ still has today. - Computers in the 90s really did no…

Back in the days of Turbo Pascal 5.5 I had a secondary monitor, a monochrome orange phosphor, connected to an EGA card, I think. The main screen was VGA. Two monitors provided a huge productivity gain, with common and cheap hardware, and it was super cool. Turbo Pascal was the only software I used that could display on the second monitor. Sometimes I miss seeing everything in orange.

Re: Why use Pascal?

#152

Earlier quoted context omitted.

How is OCaml strongly typed if it doesn't have declared types?!?!? (EDIT: In case it's not obvious, I'm being sarcastic, I'm pretty sure some people in this discussion won't get that though.) let f x = x + 1;; (* What's the type?!?!? *) Turns out that "strong typing" is a shitty phrase that people should stop using because it means too many conflicting things, and, consequently, means nothing. Static and dynamic typi…

people on HN often claim that Python is "strongly typed" while PHP is loosely-typed, but I don't see the difference honestly. both are pretty loose. re: 1 + "1" I didn't get your point really. My reply was to counter claim that Python is supposedly "strongly typed" and I don't understand how this strong typing helps developers. I know that languages can infer types, which is tangential subject. I dont know why you br…

Try that line in both Python and Perl and see how they behave, you'll see that one (Python) respects types (the most useful notion of "strong typing" is no or limited automatic type coercion and "weak typing" as an excessive permissibility around mixing of types in operations) and the other (Perl) does not.

I pointed out the OCaml example because both you and your sibling poster brought up type declarations as somehow mattering with respect to "strong typing". OCaml doesn't require type declarations, so I guess it's weakly typed according to both of you. Which is a surprising result.

Re: Why use Pascal?

#153

Often overlooked, the Ada embedded ecosystem has advantages of maturity in static analysis, debugging, and target support.

Does Ada support Android and iOS targets yet? Last I checked there didn't seem to be any obvious way to build for NDK.

iOS yes: https://docs.adacore.com/gnat_ugx-docs/html/gnat_ugx/gnat_ug...

Never used it though.

Re: Why use Pascal?

#154
post #87

Unless you want a C++ with a different syntax and less features then there's no reason to learn Pascal in 2023. And the syntax is much worse, you can't even declare variables in the middle of a function it has to go before the function. This slows you down from real work (art code comes later). It also makes worse code as declaring near the usage point makes code more clear.

That's completely missing the point. While Pascal can be used for serious work, it is first and foremost a teaching language friendly to beginners meant for introducing people (who back in the day) likely started with something like BASIC to concepts of structured and objects oriented programming. The syntax is easy to learn, fairly clean and the language has very fast compilation (C++ really can't compete here). Whi…

> While Pascal can be used for serious work, it is first and foremost a teaching language friendly to beginners

But that's not what the linked article argues as a reason to use (Object) Pascal.

> The syntax is easy to learn, fairly clean and the language has very fast compilation (C++ really can't compete here). Which is important when teaching - permits rapid iteration.

1. There are other languages than C++ you know...

2. For language-teaching purposes, basically _any_ language compiles essentially instantaneously on modern hardware (including C++).

Re: Why use Pascal?

#155
post #128

Pascal is actually good and perfomant. It was the second language I picked up in high school after Basic. I don’t understand why as an industry we had to regress to Python, Ruby, Java, & Javascript in late 90s & early 2000.

I saw a talk that touched on this recently: https://www.youtube.com/watch?v=Tml94je2edk

He explains that dynamically-typed languages like Python, Ruby, and JS became popular in the 90s because they offered a fast feedback loop for website building, and they didn't need an IDE or compilers, which were slow (and often not free). It ended up not being worth trading your development time for the performance increase when all your users were connecting via 56k modem anyway.

The talk makes a lot of other cool points about how development has changed in the past decade or two, and why the trend is moving back to static typing.

Re: Why use Pascal?

#156

Earlier quoted context omitted.

people on HN often claim that Python is "strongly typed" while PHP is loosely-typed, but I don't see the difference honestly. both are pretty loose. re: 1 + "1" I didn't get your point really. My reply was to counter claim that Python is supposedly "strongly typed" and I don't understand how this strong typing helps developers. I know that languages can infer types, which is tangential subject. I dont know why you br…

Try that line in both Python and Perl and see how they behave, you'll see that one (Python) respects types (the most useful notion of "strong typing" is no or limited automatic type coercion and "weak typing" as an excessive permissibility around mixing of types in operations) and the other (Perl) does not. I pointed out the OCaml example because both you and your sibling poster brought up type declarations as someho…

I never do 1+”1” in my code, so this example is not useful to me.

I do however annotate types and expect Python to respect type annotations which is not the case. Then I dont understand what is point of annotating types if they are not respected?

If your argument that Python doesn’t convert from one type to another - well, it doesn’t need to do that if doesn’t care about types in the first place and lets you pass any junk into any method (and this is #1 thing that type system is supposed to prevent)

Is it only for documentation so that people reading code could understand what types to pass?

Re: Why use Pascal?

#157

> modern, readable, fast, type-safe, cross-platform programming language Let's assume this is all true (although I wouldn't say it's particularly modern, and I don't know about some of the rest). And let's forget that some of these adjectives are relative or subjective. Even under that assumption - there are other programming languages which meet these criteria. Why would we prefer Object Pascal over them? Especially…

"For those who like this sort of thing, it is the sort of thing they like." - attributed to a number of people.

There are other languages which meet these criteria. But if Pascal fits the way your brain works, then it does. So use it.

And if it doesn't fit the way your brain works, then don't.

People are different. It doesn't hurt to have different tools.

Re: Why use Pascal?

#158

Earlier quoted context omitted.

How is OCaml strongly typed if it doesn't have declared types?!?!? (EDIT: In case it's not obvious, I'm being sarcastic, I'm pretty sure some people in this discussion won't get that though.) let f x = x + 1;; (* What's the type?!?!? *) Turns out that "strong typing" is a shitty phrase that people should stop using because it means too many conflicting things, and, consequently, means nothing. Static and dynamic typi…

people on HN often claim that Python is "strongly typed" while PHP is loosely-typed, but I don't see the difference honestly. both are pretty loose. re: 1 + "1" I didn't get your point really. My reply was to counter claim that Python is supposedly "strongly typed" and I don't understand how this strong typing helps developers. I know that languages can infer types, which is tangential subject. I dont know why you br…

> I don't see the difference honestly. both are pretty loose.

There's a clear difference, in PHP 1 + "1" is 2, in Python it's a TypeError, (and as a bonus, in Javascript 1 + "1" is "11").

The definition of "strongly typed" being used is related to type coercion, not type inference. In PHP the string is being coerced to an integer, but Python requires you to explicitly say 1 + int("1") if you want to add the numbers together. This can be helpful to developers because it requires you to make a decision about what behavior you actually want rather than assuming you want to add two numbers or concatenate strings when you may have wanted the opposite.

Re: Why use Pascal?

#159
post #129

Earlier quoted context omitted.

"- there's no assignment operator in maths" There is no assignment but in math we use := to express that two things are equal per definition . I never said it was the same thing, just that it is the closest thing. From a math perspective it makes total sense, while singular = for assignment makes no sense at all. Especially when you want express the concept of equality as well and cannot use the obvious choice = anym…

Edit: In his Pascal report Wirth mentions math zero times: http://pascal.hansotten.com/uploads/books/Pascal_User_Manual... And in fact in 1971 he wrote that it was basically copied from ALGOL: https://oberoncore.ru/_media/library/wirth_the_programming_l... Edit2: Most relevant part from second link: "The syntax has been devised so that Pascal texts can be scanned by the simplest techniques of syntactic analysis". Tha…

Wirth doesn't mention math as inspiration because it is obvious.

Surely he derived the syntax from ALGOL, that is no secret, but it was his choice to do so and not invent something unconventional like Thompson and Ritchie did.

In addition to that I find it quite telling that ALGOL's designers were all mathematicians while Thompson and Richie were Electrical Engineer and Physicist respectively.

I don't know why you put equals by definition into quotes as if I had invented that and also why you falsely claim that it is not listed on the Wikipedia page you referenced. It is there with := as symbol in the section about equality.

If you need another reference:

":= (the equal by definition sign) means “is equal by definition to”. This is a common alternate form of the symbol “=Def ”, which appears in the 1894 book Logica Matematica by the logician Cesare Burali-Forti (1861–1931). Other common alternate forms of the symbol “=Def ” include def “=” and “≡”, the latter being especially common in applied mathematics." [1]

Sure, there are alternative forms but := is what was taught in Germany and Switzerland in schools and university when I was there and I'm pretty sure also when Niklaus Wirth was there.

[1] https://www.math.ucdavis.edu/~anne/WQ2007/mat67-Common_Math_...

EDIT:

In Niklaus Wirth's own words:

"A notorious example for a bad idea was the choice of the equal sign to denote assignment. It goes back to Fortran in 1957, and has blindly been copied by armies of language designers. Why is it a bad idea? Because it overthrows a century old tradition to let “=” denote a comparison for equality, a predicate which is either true or false. But Fortran made it to mean assignment, the enforcing of equality. In this case, the operands are on unequal footing: The left operand (a variable) is to be made equal to the right operand (an expression). x = y does not mean the same thing as y = x."

—Niklaus Wirth, Good Ideas, Through the Looking Glass

Re: Why use Pascal?

#160
post #140

I see Go as a direct competitor to Pascal, in particular for all the points mentioned in the article. But Go has a modern runtime (with garbage collection), a modern ecosystem (with major libraries such as HTTP and TLS in stdlib) and an active community.

I do not. Co-routine thinking is more complex than imperative coding regarding the teaching aspects.

Java and more concrete C# are the one who took Pascal and Delphi originally out of the game for day to day programming. And Go is already so much more popular than Pascal for real life work, that competition is a really the wrong word.

Post reply on HN