Live data from Hacker News

Why use Pascal?

castle-engine.io

261–270 of 516 posts

Re: Why use Pascal?

#261
post #235

Earlier quoted context omitted.

Where does Microsoft use Scala? Or every bank out there?

Machine learning: - https://github.com/microsoft/scala_torch - https://microsoft.github.io/SynapseML/ - https://www.infoworld.com/article/3236869/what-is-apache-spa... And Microsoft of course owns LinkedIn which is built on a Scala backend.

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?

Re: Why use Pascal?

#262

Earlier quoted context omitted.

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…

Sadly it seems not to be available for such systems. Though for reference compiling my sample "Hello World" script on TP gives me a "hello.com" file which is 8320 bytes. 64k is as much memory as I have on the machine, so if it were 50-60k I'd be worried there would be no space left for anything else!

Use optimisation to get the binary down to 1k. I did just that yesterday.

Re: Why use Pascal?

#263
post #247

Earlier quoted context omitted.

Thanks again for the hints; I'm not (yet) fluent with FreePascal and assumed to be much faster when quickly implementing a rudimentary parser to make arbitrary queries over the source code (the one I implemented for Lisa Pascal/Clascal including the browser/cross-referencer took a week as a side project) than discovering and learning all the required FP libraries and tools; but the FP language turned out to have some…

Yeah, Free Pascal is far from simple. It not only tries to implement everything Delphi provides (itself never being a "simple" language) but also as much as other Pascal dialects provide (via compiler modes) and various useful features from other languages - and that in backwards compatible ways (often via "modeswitches" - kinda like submodes). With that in mind it is kinda interesting that there are (AFAIK) three pa…

> Free Pascal is far from simple.

It's still much less complex than e.g. Ada or C++, and unfortunately, the language has redundant, competing concepts that are probably explained by - as you say - putting different languages and design styles together; it's definitely not my favorite language.

Unfortunately, there was also no complete and correct grammar, so I had to create one myself, and even in this one there are still productions without definition, e.g. array_constant, record_constant and procedural_constant. At least the syntax diagrams were not left recursive, and also removing ambiguous alternatives was straight forward.

Surprisingly, the FP language specification does not distinguish between language variants; only the compiler knows different modes. There seems to be a common grammar for all modes.

Re: Why use Pascal?

#264

Earlier quoted context omitted.

> (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!

s/For/Fork/

Re: Why use Pascal?

#265
post #213
post #208

Earlier quoted context omitted.

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…

Well, a lot of those requirements are highly bespoke to your task and to your team. My C# pipelines and C# apps are far easier to package and deploy than my Python apps for example. And, as you said, the pipeline is normally a one time cost.

We were talking Delphi vs C#. Where does Python fit in?

Re: Why use Pascal?

#266

Earlier quoted context omitted.

> Using the symbols for the same concepts in both worlds is the obvious and sensible choice. Yeah, but has already been established in this conversation, you're not using them for the same concepts. So your argument doesn't work. Repeating it over and over isn't going to make it work, either. > The reason why C did choose a different convention was that it preferred similarity with FORTRAN which is so old that it was…

"Yeah, but has already been established in this conversation, you're not using them for the same concepts. So your argument doesn't work. Repeating it over and over isn't going to make it work, either." No, we've established that math and programming languages are different things. Both share some concepts that are close enough so that using the same symbol is the obvious and sensible choice. It's not that equality i…

> I never said that. I said C chose to reuse the symbols from FORTRAN. To repeat part of the Wirth quote from above (but it's easy to find other sources):

> "It goes back to Fortran in 1957, and has blindly been copied by armies of language designers."

That's a pretty broad brush that Wirth is painting with. All those other language designers were blindly following FORTRAN; I'm the only one with the wisdom to break precedent. Yeah, um... that's way too broad a statement. Each language followed precedent and broke precedent in certain areas, and they all did so for what they thought were good reasons. "What people are used to" is one reason, but far from the only one. The "number of characters" reason was one I read from (IIRC) Brian Kernighan. I trust him to have a better grasp of the design logic of C than Wirth does.

Re: Why use Pascal?

#267
post #182

Earlier quoted context omitted.

I believe they are in C, but arrays degrade to pointers when you look at them wrong, and _those_ don't have length as part of their type. At least I'm seeing: `array type 'int[3]'` in messages when I tried to do something wrong with it quick to get an error message (using llvm), maybe that's a compiler specific thing.

> when you look at them wrong no, almost whenever you look at them. it is very hard to carry around the size of an array in C. > At least I'm seeing: `array type 'int[3]'` in messages when I tried to do something wrong with it quick to get an error message (using llvm), maybe that's a compiler specific thing. post some code that illustrates what you are talking about

I was trying to get clang to throw an error that included type information to double check what it thought the type was. Quickest thing I could think of was trying to assign to an array.

The exact error in question was: error: array type 'int[3]' is not assignable

Which seems to imply that clang is considering the length to be part of the type.

edit: You asked for code (my apologies that it's rather trivial).

    int x[3] = {1, 2, 3};
    int y[3];
    y = x;

Re: Why use Pascal?

#268

Earlier quoted context omitted.

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

I think the main reason for keywords being uppercased in Oberon (which is case sensitive) is to free up the space for user-defined identifiers. As long as the programmer sticks to lowercase and mixed case identifiers, new keywords and predefined procedures can be introduced in the language without invalidating old programs.

Wirth could have figured out a better way to do this, or asked around.

You can have a way for a program to declare the version of the language it wants. Then keywords introduced in all newer versions of the language disappear (are treated as ordinary identifiers).

Via a mechanism like Racket's #lang, Component Pascal could support Oberon-2, Oberon, Modula and even Pascal translation units in the same program.

It does seem as if Wirth operated with serious academic blinders on. He had no concept of treating the language as a product, which supports existing users with dogged backward compatibility. The result was a fragmented landscape of languages, which helped eroded the popularity of the languages.

The C preprocessor has been much maligned, and usually rightfully so, but with the preprocessor, I can take C code that uses C++ keywords like class and new, and make it work. We can easily write a macro convert(type, expr) which will expand to static_cast(expr) when the code is compiled as C++, and to (type) (expr) when compiled as C. C itself has been able to bring in new keywords like bool, true and false without breaking old programs which use these, by requiring programs to include a header from which you get things like #define bool _Bool.

Speaking of C++, most C programs can be easily converted to C++, often with little or no modification. Or at least that used to be true for a long time back in an era when it was important to be able to do that.

Re: Why use Pascal?

#269
post #261

Earlier quoted context omitted.

Machine learning: - https://github.com/microsoft/scala_torch - https://microsoft.github.io/SynapseML/ - https://www.infoworld.com/article/3236869/what-is-apache-spa... And Microsoft of course owns LinkedIn which is built on a Scala backend.

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.

Re: Why use Pascal?

#270

Earlier quoted context omitted.

> All but the stupidest compiler (which usually means no optimisation at all, not even precomputing constants) will not be affected by completely extraneous variables. The statement is certainly false in this general form, even with full link-time optimizations. If the type has a constructor with side effects external to the program (e.g. it makes syscalls), the compiler cannot remove the variable.

If they cause visible side-effects, they are by definition not extraneous.

I'm not interested in playing this semantics game. The compiler can't know whether a syscall has side effects. And some side effects can be benign and irrelevant, and you definitely left the variable in by mistake, but they're still side effects.
Post reply on HN