Live data from Hacker News

Why use Pascal?

castle-engine.io

271–280 of 516 posts

Re: Why use Pascal?

#271
post #261

Earlier quoted context omitted.

Small projects, most of the stuff they do in ML is based on C++ and Python. Hence why they hired Guido and are putting money into optimising CPython. LinkedIn is a separate entity, even if owned by Microsoft. Zero Scala content at BUILD. What about the banking world across the globe, no numbers?

Just search any job board for 'spark', you will see plenty of banks and many other companies.

Plenty of banks isn't every bank.

Re: Why use Pascal?

#272

Earlier quoted context omitted.

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…

A clear example of why it is a pro is the index of a for loop. Why would it be more maintainable to declare all for loop indexes at the beginning of a function? They are basically bound variables that are only meaningful within their loop, and they are usually not even worth commenting.

More often than not, when maintenance really matter and juniors really choke, the algorithms that powers core functionality usually have nested loops and conditionals. So if you start using inline variable declaration you really have a hard time "where did this was declared". Combine that with compiler switches and you have a recipe for disaster when declaring inline variables vs. a clear section of variables right after function header, where you put all comments to specify what those variables do.

Remember, initial phase of a project is only 10% of it, the maintenance and expanding its functionality is the rest of 90%. Inline variable declarations are a real PITA for that phase.

Re: Why use Pascal?

#273

Earlier quoted context omitted.

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…

Please do another "for" right after this one, identical, and then revisit this comment (hint: you'll get a syntax error).

Re: Why use Pascal?

#274

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…

Oh Pascal!, oh the nostalgia. I saved up the princely sum of $80-$100 back in TRS-80 Model III days to buy the Pascal 80 package, the New Classics version, which was basically a proto-IDE, and a pretty sweet one at the time. http://www.trs-80.org/pascal-80/ I recall it being a huge step up from the M-III BASIC dev environment and the games and utilities I wrote ran well enough in the 48K of RAM that was available. I…

Wow.

"Oh Pascal!" was a fantastic book, both for the content (going from beginner to a bit intermediate (1), in a single, not too thick book) and for the fun and engaging writing style, and with very good production values too, meaning the book's appearance.

IIRC, it was written by one or two US postgraduate college students or professors. My uncle, who was himself a college professor in the States, brought it for me on one of his visits to us, as a present, because he knew I was learning computers.

And during that visit, I wrote a small scientific program for him in Turbo Pascal, to use in his lab.

(1) Why I said "a bit intermediate" is because it had, near the end of the book, a program to do text concordances, and maybe one or two other non-trivial ones too.

Re: Why use Pascal?

#275
post #9

I disagree with some of their reasons. Modern: Object Pascal isn't a modern language. It was modern in 1998, maybe, but it hasn't evolved much since then. Latest big change was the addition of generics, behind almost any other language. Fast: FPC doesn't generate particularly fast code, and the nature of OP objects doesn't help with locality. It's faster than scripting languages, but generally slower than AOT compile…

I also think the modern part is exaggerated here. Object Pascal was had cutting edge features and developer experience in the 1990s, but I think it's hard to see it this way nowadays. There are two big features that one expects in a "modern" language that are missing in object pascal: 1. Some sort of automatic memory management that prevents memory leaks and dangling pointers. Modern languages usually have GC, automa…

There are other reference counted types with copy-on-write, like strings and dynamic arrays, it isn't only interfaces.

Re: Why use Pascal?

#277
post #252

Earlier quoted context omitted.

Comparing to Python is not exactly fair. I don't think there are any languages that have a worse deployment experience. How does it compare to Go or Rust?

They want obfuscation. Rust libraries necessarily include the AST for public generic functions. So it may not be suitable.

I think that's a totally different topic, but regardless it's the same with C++ and I don't see that being a big issue to C++ library vendors.

Rust doesn't have a stable ABI so it's not like you could realistically distribute a closed source "native" Rust library anyway.

Re: Why use Pascal?

#278

Earlier quoted context omitted.

i do not think you understand the concept of scope.

I’ve written a few compilers in my time so I have some idea about scoping rules ;) As I and other have already said, it depends on the specific language. Some languages scope local variables at the function level (irrespective of {} or Begin End), and other languages scope local variables inside the containing {} or Begin and End block. In that regard {} and Begin End serve identical purposes of defining a local exec…

> As I and other have already said, it depends on the specific language. Some languages scope local variables at the function level (irrespective of {} or Begin End), and other languages scope local variables inside the containing {} or Begin and End block.

And some languages do either, depending on the keyword used to declare a variable. Looking at you JavaScript(var vs let).

Re: Why use Pascal?

#279
post #208
post #199

Earlier quoted context omitted.

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

Ah, I've not had to combine DLLs, obfuscate code, sign code or create Nuget packages.

All of that does sound painful.

What makes it easier in other languages? Is it a matter of better tooling?

Re: Why use Pascal?

#280

Earlier quoted context omitted.

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

Please do another "for" right after this one, identical, and then revisit this comment (hint: you'll get a syntax error).

> hint: you'll get a syntax error

No. You won't. You didn't even try it, did you.

Read the documentation, use inline variables, and be happy.

Post reply on HN