Live data from Hacker News

Why use Pascal?

castle-engine.io

161–170 of 516 posts

Re: Why use Pascal?

#161

Earlier quoted context omitted.

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…

Python type annotations were added to be used by an external type checker, so no they are not enforced by the interpreter itself.

This was an explicit decision: https://peps.python.org/pep-0484/#non-goals

Re: Why use Pascal?

#162
post #158

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…

> 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 t…

String concatenation is probably the most reasonable result aside from a type error given how + is used in JS for concatenation elsewhere, but JS actually gets funny.

  "1"*2 // => 2 (not "2")
  "1"*2+3 // => 5
  "1" - 2 // => -1
  "9"/3 // => 3
  "9" + 3 // => "93"
So some mathematical operators will convert string parameters to a number, but not +.

Re: Why use Pascal?

#163
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…

Do not forget Pearl.

Re: Why use Pascal?

#164
post #61

I won't even bother clicking this click bait title. I learned Pascal as a sophomore in high school and by my senior year I knew I'd never touch it again. At the time it was a great introductory language but there's very little reason anyone should even be thinking about Pascal these days. Fun fact: I still have my old pascal files on floppy disks in a box somewhere with a not so thin layer of dust on them.

I still think it is brutal we let our industry rookies learn complicated programming concepts in complicated languages like Java, python, js or god forbid anything functional.

I still think it is a huge mistake be Microsoft to let Basic rot away and that our industry should focus teaching on something like Pascal which does not stand in your way

Re: Why use Pascal?

#165

Earlier quoted context omitted.

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.

I had a VGA and a Hercules card and it's probably hard to relay how super cool that was at a time and in an environment where computers alone were pure magic to most people. Then there were these kids, like us, that could not only use these magic programs but could control and manipulate them from a second screen:-)

Re: Why use Pascal?

#166

> Why use Pascal? Because you like Niklaus Wirth's languages, and only those ... but only up to Pascal. You don't think that the improvements in his subsequent Pascal-like languages are Wirth a damn. You believe that Wirth went soft in the 1970's and 1980's, and sold out Pascal. If that is you, you probably write code in Pascal, implement Pascal, write about Pascal ... (Everyone else should probably skip Pascal and t…

> (Everyone else should probably skip Pascal and take a look at Modula-2 and Oberon.) I did check out Oberon-07 because of its minimalism but i really couldn't get over the SHOUTY keywords :-P. (Wirth used uppercase for Pascal's keywords too but unlike Oberon, Pascal is not case sensitive - my pet theory is that Oberon is case sensitive as a reaction to Pascal programmers not using shouty capitalization :-P)

Yes, forcing uppercase keywords is rather unfortunate; have a look at https://oberon-lang.github.io/

Re: Why use Pascal?

#167

Earlier quoted context omitted.

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…

Python type hinting is not useful at runtime (in fact it's flat out ignored). It is useful at "linting" time when run through mypy.

Re: Why use Pascal?

#168
post #18

Earlier quoted context omitted.

the greatest difference btw Pascal and C++ is developer experience. Pascal uses a single-pass LL(1) compiler, which allows you to compile in milliseconds. Pascal enables REPL-like experience where you can Edit->Compile->Run in less than a second. C/C++ with macros and slower compilation times is worse developer experience, at least it was the reason for me to learn Pascal instead of C and Delphi instead of C++

Just to add more context: Niklaus Wirth's foresight was to design Pascal's syntax to allow a single-pass compile. But it took more than 15 years until we actually had a blazingly fast single-pass compiler and that is totally Anders Hejlsberg's merit.

My memory is fuzzy, but even before Hejlsberg magic, Wirth parser was a light and fast (but maybe unreadable) hand coded piece of code.

Re: Why use Pascal?

#169
post #111

I used to use Delphi/Pascal as my main language. In the last decade or two I have been on a bit of a journey looking for a language that feels right to me. I used Haxe for quite a while but I felt Haxe fell into the trap of 'There's a Macro for that' (Macros can do anything, but ultimately enough macros make everyone programming in their own macro augmented language). JavaScript developed decent improvements (but cou…

> Begin End vs { } doesn't really bother me. but they don't really mean the same thing - {} defines a local scope, begin...end doesn't.

They are both used to define blocks. Eg Begin … End in for loops https://wiki.freepascal.org/For

From what I recall, Pascal doesn’t support variables scoped within a specific block. But then neither do some languages with C-style curly braces too.

So {} and Begin…End are pretty much the same thing.

BASIC (and Visual Basic especially) often get a lot of criticism for their syntax but the End Thing style block terminator was very clear.

It’s a pity that the only popular alternative to C-style braces is Python because I do think ALGOL-style syntax has a lot more going for it than people give it credit.

Re: Why use Pascal?

#170

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…

TP IDE was indeed magical. Except for one pain point, from an emacs user POV, no extensibility. You can't tweak the ergonomics so you're stuck with what the devs put in. It was 99% perfect but that broke me out of it.
Post reply on HN