Live data from Hacker News

Why use Pascal?

castle-engine.io

221–230 of 516 posts

Re: Why use Pascal?

#221

Many people using Delphi back in the day will probably already know Lazarus, which is essentially an Open Source recreation which runs and compiles natively pretty much everywhere, Raspberry PI and similar ARM boards included. Installing libraries however can be tedious, therefore FpcUp and later FpcUpDeluxe were created to automate the task of installing the IDE along with other modules and some quite interesting ad…

> free widgets

Are you saying there are paid widgets? I use Qt5, which comes with more widgets than I know what to do with. Are the ones that come with Lazarus limited?

Last time I tried Lazarus (and Delphi), Unicode was difficult. Everything seemed to assume ASCII.

Re: Why use Pascal?

#222

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.

I never understood why is declaring variables in the middle of the code a "pro" for some. In my experience that's a "con" especially because of maintainability. Same way you do a comment before declaring a function to explain its purpose, you do a comment for each variable to declare its goal within said function. That's proper maintainability for a project. Also Delphi, for past 2 years, has this "middle" variable d…

> I hate it, never used it

You should at least use it in for loops. It's a useful improvement, and especially handy in combination with type inference. For example:

  for var i := 1 to 10 do
    Inc (Total, i);
i is declared inline, it's only in scope inside the for loop, and the type is inferred from the bounds of the loop. You could of course use "for var i : Integer := 1 to 10 do" if you wanted to be explicit about the type.

Documentation: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Inli...

Re: Why use Pascal?

#224
post #204
post #120

Earlier quoted context omitted.

It's the language itself; I currently build a parser for FP 3.2.2 and I need more look-ahead than LL(1) in different parts of the syntax. And it has features which require more than one pass.

One thing this thread seems to forget, Pascal sources do not include literal kilometers of headers compared to C++, and there’s no code in Interface sections either. Every C++ translation unit explodes into a full set of libs at preprocessing phase. One pass or LL(1) is just a cool bonus compared to that.

Delphi and FreePascal have compiler directives and include files quite similar to C, and it's commonly used e.g. in the FP source tree, albeit to a lesser extent than in a typical C/C++ project.

Re: Why use Pascal?

#225

I'm finding myself using Pascal for fun these days due to resource constraints. The old release of Borland's Turbo Pascal, version 3.00A, runs under CP/M and provides an editor, compiler, and libraries all under 64k. It's fast enough to use interactively, and produces code that is good-enough to implement low-level utilities, simple games, and other random hacks. I've not used Pascal on anything larger, or more moder…

Check out Free Pascal (FP) if you haven't already. It supports many platforms. You can check on their site if it supports CP/M if you need that. I would not be surprised if it did. The TUI IDE is very similar to Turbo Pascal, and lightning fast. The language has a lot more (advanced) features than Turbo Pascal, but you don't have to use them if you don't want to. The generated binaries were also very small, similar t…

'under 60 kb' for a cp/m machine is like 'under 60 gb' for the laptop you're probably using

Re: Why use Pascal?

#226

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.

Seems like you haven't been using the Object Pascal dialects of Delphi or PascalABC, which let you declare variables everywhere. In the case of Delphi, Embarcadero has been making it as easy as possible to switch between their Delphi and C++Builder products lines.

For Free Pascal, the developers and many users voted against that, because it appears the opinion was it leads to sloppy code and unnecessary errors. The other point, is that Object Pascal has for a very long time allowed nested functions, so it wasn't arguably that much of an issue for those on that side. It seems more like C/C++ users wanted to force their habits on Pascal, which Embarcadero sold out to, for a few extra dollars. PascalABC, copied what Delphi was doing, who they use as a quasi-standard.

Re: Why use Pascal?

#227
post #221

Many people using Delphi back in the day will probably already know Lazarus, which is essentially an Open Source recreation which runs and compiles natively pretty much everywhere, Raspberry PI and similar ARM boards included. Installing libraries however can be tedious, therefore FpcUp and later FpcUpDeluxe were created to automate the task of installing the IDE along with other modules and some quite interesting ad…

> free widgets Are you saying there are paid widgets? I use Qt5, which comes with more widgets than I know what to do with. Are the ones that come with Lazarus limited? Last time I tried Lazarus (and Delphi), Unicode was difficult. Everything seemed to assume ASCII.

Unicode was fixed in 2007 (or thereabouts). I think thats a problem with Delphi (and Lazarus) everyone compares it to when they used Delphi (in 1999) it didn't do this cool thing that languages in 2023 do, however modern day Delphi does a lot more stuff. It's worth a revisit, I use it with the skia graphics engine to create multi platform apps very easily.

Re: Why use Pascal?

#228
post #207

Pascal isn't too bad; actually I think that it has some advantages over some more modern programming languages. It isn't perfect though and does have disadvantages too. I sometimes use for Pascal and BASIC for DOS programming; Pascal does look OK for that, at least (and C seems not as good for DOS programming (at least in real mode), even though it is sometimes done). However, for programming in Linux, I generally pr…

What's your use of Postscript? I find fascinating when people use it for anything other than print related stuff

you may appreciate http://postscriptcode.com/ by nathan laredo

i wrote a parametric 2-d cad system in postscript: http://canonical.org/~kragen/sw/laserboot/cut-3/README.md.ht...

it's a very flexible dynamic language, much like lisp, and a little less like python, but with much better performance than python

Re: Why use Pascal?

#229

Earlier quoted context omitted.

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

The most C-style language is C and it does have variables scoped to a block, I believe. The same for C++.

I was using “C-style” with respect to {} syntax for compound statements rather than language specification because the GP is discussing language grammar.

Re: Why use Pascal?

#230
post #106
post #93

Earlier quoted context omitted.

Both made it into modernity as large swaths of Golang. Modula-2 even had coroutines.

Go has surprisingly little in common with Oberon or Modula (mostly the receiver syntax of Oberon-2 bound procedures). The coroutines were not a language feature of Modula, but a library feature; also the Oakwood guidelines of Oberon (not by the original authors) include a coroutine API, but I'm not sure whether there was a working implementation.

golang is basically newsqueak
Post reply on HN