Live data from Hacker News

Why I use Object Pascal

dubst3pp4.github.io

201–210 of 235 posts

Re: Why I use Object Pascal

#201

Earlier quoted context omitted.

> PHP in theory has namespaces, but the standard libraries are just dumped in global. Modern PHP development almost exclusively uses Composer libraries rather than the standard libraries, which overwhelmingly use namespaces in Vendor\Project format. There's going to be a push to clean up the standard library in the coming years. The plan is to introduce a namespaced alternative to the standard library in the global n…

Namespaces by 2020? That'd be nice. The \ syntax still makes my eyes bleed a bit, when most others use . or :

I think there's some reason they landed on that one, but seriously, if that's your biggest complaint about the language...

Re: Why I use Object Pascal

#202

Earlier quoted context omitted.

C has no classes, and everything's in one global namespace. Scheme & LISP have no built-in classes, and one can argue that CLOS isn't what we normally describe as OOP. Both normally have a global namespace. Inheritance in JavaScript is possible but very hard to implement correctly before ES6. Node has namespaces (sort of) but client-side JavaScript generally doesn't. PHP in theory has namespaces, but the standard lib…

> PHP in theory has namespaces, but the standard libraries are just dumped in global. Modern PHP development almost exclusively uses Composer libraries rather than the standard libraries, which overwhelmingly use namespaces in Vendor\Project format. There's going to be a push to clean up the standard library in the coming years. The plan is to introduce a namespaced alternative to the standard library in the global n…

I've posted this before but I've really been pleasantly surprised by how good working in PHP7 is. It's not my favorite but I certainly like it more than Ruby.

Re: Why I use Object Pascal

#203
post #55

Earlier quoted context omitted.

I'm not saying these are features provided by every modern programming language - obviously eg. there are FP languages that are not object-oriented, as you pointed out. Still, the selection of languages that do is so vast that such reasons hardly answer the question "why Pascal, of all the options".

There are only a few "popular" languages that have both, many that don't; those are not mandatory features for everyone. I care about performance (ruling out any GC language), multi-platform native binaries, language readability, dev community, and a bundle of other factors. Pascal turns out to hit most of my needs and not annoy me too much. Of the thousands of more obscure languages, I'm sure there's one that'd be p…

> I care about performance (ruling out any GC language)

[Citation needed]

Re: Why I use Object Pascal

#204
post #111
post #12

Yeah I've written compilers for Swift, C#, Java, JavaScript and Pascal and agree Pascal is the cleanest and nicest language, both on the parsing side and writing in.

Pascal language has a LL(1) grammar, typical for Wirth and other 1980s work. LL(1) grammars are of great practical interest, as parsers for these grammars are easy to construct, and many computer languages are designed to be LL(1) for this reason.

Is this why Ada's syntax was extended from Pascal?

Re: Why I use Object Pascal

#205
Anyone here used PascalScript[0], specifically with compiled Pascal itself? I am planning an application that is compiled and delivered with PascalScript to allow the end user to extend and customise the application without access to the source code. Preferrably using FreePascal.

[0]http://www.remobjects.com/ps.aspx

Re: Why I use Object Pascal

#206
post #127
post #116

My dad still runs his business on a software I wrote in 1998 in Delphi. I haven't touched it since then but it is the only code I have that still works 19 years later.

Does it runs on modern Windows or is it running on a VM?

I have a large codebase in Delphi 5 (1999), still being maintained and developed. The applications produced work on all current Windows versions w/o problems. Delphi itself works on Windows 10 albeit requires some tricks to install properly.

Re: Why I use Object Pascal

#207
post #147

Earlier quoted context omitted.

> Perl can do pretty much everything Python can, and it came significantly earlier. Yet people gravitated toward Python. I don't think syntax is the main culprit here, and Perl is only four years older than Python. For about 15 years Python tried, unsuccessfully, to compete with Perl as the premier language for shell scripting and sysadmin tasks. It wasn't until around 2005 that Python finally caught on, its rise coi…

I have long thought Perl can do anything Python can, and then some. I still use Perl one-liners to find/change strings in code bases: perl -pi -e 's/somestring/newstring/g' $(ag -l --python Foo) Does Python have an equivalent? I think the fabulous Python libraries for data science have really propelled the language to the top of the list, in terms of users.

CPython doesn't really have a "stream mode" like `perl -pi`, but you could easily make a pretty trivial wrapper to do it if you found yourself wanting to duplicate that functionality. I'd much rather use sed or awk in your specific case and similar, but to each his own.

Re: Why I use Object Pascal

#208

What caused pascal to lose out to C? Seems like it was a good language that had developer uptake.

A few big changes happened in the 90s.

- Internet rapidly became increasingly ubiquitous. And it was largely aligned with the Unix philosophy of plaintext formats.

- Computers became fast enough and powerful enough to make interpreted languages (and VM-based languages) usable.

- Open source took off.

- This produced explosion of new, free scripting languages that were really good at working with strings, dynamic data structures, and plaintext formats.

- Visual Studio and Delphi both still cost thousands of dollars. Not something you could download and evaluate or try out. Not something you'd decide to learn on a whim. And not something with a big community of open-source developers sharing things for free. Delphi made the business decision to price out the small shops and individuals that were its customers in hopes of going after an enterprise market.

- Except in some areas (games, embedded, etc.) the industry shifted toward making things with open-source scripting languages or java for the business stuff. Those who remained in desktop and didn't switch to java switched to visual studio.

- The creator of Delphi left and went to Microsoft and created C# to compete with java.

The static languages were also somewhat slow to adapt to plaintext data formats. They typically used proprietary binary formats and those were easy to work with (they could basically directly load and dump to/from RAM/disk). But serializing and unserializing and marshaling and unmarshaling to/from plaintext formats was a pain. Eventually they got generics and templates and macros and things to make it less painful, but it's still nowhere near as simple as in the typical interpreted dynamic language. (I recently modified an old 80s-90s era C program to output JSON and did some work on getting a Pascal program to read it.)

Re: Why I use Object Pascal

#209
post #116

My dad still runs his business on a software I wrote in 1998 in Delphi. I haven't touched it since then but it is the only code I have that still works 19 years later.

I have a turbo pascal game from the 80s that still sort-of-works on the command box of windows 10. Unfortunately it starts, does a demo loop in which all the pacmen get eaten then exits, all within about a second. I thought it was broke for many years until I found a way of slowing dosbox right down to look for an error message and did not find one :-) Shame I havent got the source code. I also wrote an 8051 assembler and compiler again executable (com) file only but I havent looked at this for a while as its still on a 5.25" floppy... Ahhh memories!

Re: Why I use Object Pascal

#210
post #196
post #133

Earlier quoted context omitted.

They actually are, because Pascal knows the size of its types, while C requires using a mix of sizeof and malloc, which many people still get wrong, specially with arrays.

>Pascal knows the size of its types This really means it doesn’t permit variably-sized arrays without a hassle on pure language level, so you can’t fall from a bike because it’s wheels are buried in the basement. Manually-specialized Containers like TStringList still use GetMem() and align a pointer to an “infinite” array to that block, shy trick pretending to be safe until reinvented by mere mortal. Iirc, you had to…

There was no RAD in Turbo Pascal for MS-DOS, secondly I had the opportunity to live in a country where a CS degree or similar is pretty much a requirement to be hired on the field.

Quite a few parallel programming research papers were done in Concurrent Pascal during the 70s.

Besides UCSD Pascal, there were a few other OS CS research done in Pascal variants.

Variable legth arrays were available.

C string manipulation is a joke as well, given that in 2017 still doesn't have a way to handle unicode in spite of wchar_t.

The whole point of unsafe code being hard to reach for, is to force people to think instead of producing yet another artifact to hang on the CVE list.

Finally, if we are no longer discussing pure C then Pascal also has libraries and extensions, nothing special about C here.

In any case, there is no need for C when we have C++, other than keeping UNIX kernel devs happy, and legacy code.

Post reply on HN