Live data from Hacker News

Why use Pascal?

castle-engine.io

201–210 of 516 posts

Re: Why use Pascal?

#201
post #87

Earlier quoted context omitted.

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…

I was teaching programming with Pascal until three years ago, and I think the pedagogical argument might have made sense in the past, but not in 2023 (or 10 years ago for that matter). The syntax is rigid in all the wrong places. For example, not being able to declare variables anywhere doesn't really help students, this isn't something that typically leads them to errors. What does lead to lots of errors? Dereferenc…

>> Pascal had its time but I don't think there is much reason to use it now, outside of pure curiosity or wanting to try a historical language.

I use Pascal only for side job/hobby, not for daily work. Lazarus+FPC is still my #1 choice for desktop app (is this still a "thing" in 2023?). No Electron, no JVM etc etc.

For writing web/server/backend stuffs, kinda hard to argue with Go.

Re: Why use Pascal?

#202

Earlier quoted context omitted.

> 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 do: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Inli...

without that, one can use a repeat until loop to simulate I think

Re: Why use Pascal?

#203

Earlier quoted context omitted.

About pas Al in comparison to languages using {} for blocks, where some have block scoping and some don't.

no idea what you are talking about here - what is "pas Al" - post an example of what you mean.

Pascal. It’s a typo.

Re: Why use Pascal?

#204
post #120

Earlier quoted context omitted.

which Pascal compiler is it - Embarcadero or FPC?

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.

Re: Why use Pascal?

#205
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 prefer C (although I also use PostScript; I think that both C and PostScript have some advantages compared with some more modern programming languages). Pascal can be used for other programs too; even TeX is written in Pascal.

Re: Why use Pascal?

#206

first word they use to justify using Pascal is that it's "modern". Gave a glimpse at the code source screenshot. No, that syntax is very much the past.

The syntax is timeless, because it is much closer to math than B/BCPL/C heritage. It has its own issues but overall it is much better thought out than most other languages. Here is a comment I wrote a couple of months ago with more arguments for Pascal's syntax: "Yes, Rust does indeed and a long time before that it was Pascal. I really love Pascal's syntax, it makes a lot of sense when you approach it with a math bac…

> - '=' is for equality only - assignment is ':=' which is the next best symbol you can find in math for that purpose

That is just syntax. I am not so sure if it is better or worse or not, but there it is.

Different programming languages do have different syntax, and sometimes that can be helpful if their structure is different. However, what I think is that the syntax for types in C is confusing (when you are making types combining by e.g. function of array of integer, or whatever).

> numeric data types are 'integer' and 'real', no single/double nonsense

It is helpful to be able to specify how many bits you want. (In the case of integers, range types (as you also mention) might help, though.)

> 'functions' are for returning values, 'procedures' for side effects

It is useful in C to be able to have side effects and return values, and to be able to ignore return values sometimes. (BASIC doesn't have and that sometimes annoys me)

> Function and procedure definitions can be nested. I can't tell you what shock it was for me to discover that's not a thing in C.

In GNU C you can do that, although a function that refers to stuff in the function it is inside of is only valid before the outer function returns. (And, you are not allowed to declare the inner function as "static" to allow it to work even after it returns in case it does not access stuff that is only valid before the outer function returns.)

> Array indexing is your choice. Start at 0? Start at 1? Start at 100? It's up to you.

That is good, and it is useful. Usually I think starting at zero makes sense, but sometimes there is sense to start at any integer, including positive and negative numbers, so it is good to be able to specify any number.

Re: Why use Pascal?

#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

Re: Why use Pascal?

#208
post #199
post #189

Earlier quoted context omitted.

Reliably deploying C# desktop app is total nightmare in comparison to single exe generated by Delphi's / Lazarus.

I've found .Net deployments to be rock solid and easy. What problems do you hit?

A couple of months ago I started working at a company that (mainly) develops C# libraries.

The pipeline to deploy is complicated. Using a tool like ILMerge to combine DLLs into a single DLL (to prevent DLL hell issues). Using Babel to obfuscate the code base. Using nuspecs to create a Nuget package from the DLLs and various metadata. Signing the DLLs with some certificate. Then, if native stuff is included, also ensure the Nuget package can be deployed on all supported architectures. Probably some more stuff.

Setting up a pipeline in Azure devops for a product I am working on, for the company, is already taking me a week and will probably take another couple of days to complete. But at least it’s a one-time task.

Re: Why use Pascal?

#209
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

I think that it is not such a bad programming language. I have used it for both graphical and nongraphical stuff. For example:

- A library to read/write the ZZT file format. I had then also used it to make a program which will draw a graphical map (I also defined a "PCEncoding" vector, although some characters seems to not work somehow). I had also done other things with it that are not graphical, including constructing ZZT world file automatically or making batch modifications to existing world files.

- A library to parse a UHS hint file. Later, a program could also be written to allow it to be printed out, perhaps even using invisible ink or scratch-off layer if you have a suitable printer. It could also be used for interactive mode without printing.

- I wrote a program to convert the levels from a DOS game into the Free Hero Mesh level import format, in PostScript. (A similar thing can be done to convert levels from other games, I suppose.)

- I wanted to measure the computer's temperature and load over time, so I wrote a program in C to write the measurements to a file (just simple binary data with fixed length records) and then wrote PostScript program which will plot it on a graph and make a PNG file.

- I also implemented getopt and JSON and multicodec in PostScript. I don't use JSON much, although I do use the getopt implementation sometimes.

- I wanted to write a Pokemon battle simulator in C. I had used PostScript to manage some of the configuration-related stuff that is used before the program is compiled. As a side-effect, it can also make the type matchup charts in PNG as well (in addition to producing the files in the format used by the battle simulator I wanted to write), so now I have those as a reference even when playing a different game.

- I also implemented Infocom's Z-machine in PostScript, although that is mostly just to see if I can. It implements both interactive mode (without the printer, using standard I/O), and the transcript (with the printer).

Nevertheless, there are some things I would improve in PostScript. For example, add a "unread" operator (similar to ungetc in C), a built-in procedure called "#!" which just skips the rest of the line from the source file (the following slash is a new token in PostScript (which will be skipped by this procedure) so this will work), optional auto-allocation for stuff such as "readline", making warning/diagnostic/error messages on stderr instead of stdout (although "print", "=", "==" would still write to stdout; you can use "write==" etc to write to other files, but being able to do this with "pstack" would also be useful), and some other stuff. (Some of the stuff in Ghostscript is good, such as the ARGUMENTS array; that is probably the feature of Ghostscript which I use most often. %pipe% is also useful.)

Re: Why use Pascal?

#210

> 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)

For a "Loberon" dialect!
Post reply on HN