5 ms·
As I get older, I'm strongly swinging into the camp that thinks languages should have strongly restrictive syntax. Object pascal is one of those languages which
by StillBored 9y ago
As I get older, I'm strongly swinging into the camp that thinks languages should have strongly restrictive syntax. Object pascal is one of those languages which is both low level enough to cleanly map to efficient code, as well as high level enough not to feel really restrictive. Its a language that is completely misunderstood because far to many people read a couple critical essays, and believed everything they read, even though the strongest argument frequently was that its harder to type "begin/end" than "{/}". Which is a pretty lame thing, given code completion in editors as old as emacs.
Put another way, the thought patterns programmers fall into when using it seem to result in code which is easier to understand than most other languages which seem to encourage "perlism" (creating a single unreadable line), "forthism" (creating a billion two line words that combine to solve all the problems in one word), or a few other things which become completely unmaintainable when the project grows beyond what can be written by a over-energetic student in a semester at school.
- pjmlp 9y agoRegarding those essays, I consider myself lucky to have learned and used Pascal and Basic compilers before learning C. Then I just had fun showing to disbelivers how to do in TP stuff that apparently only C was capable of.
- vram22 9y ago>given code completion in editors as old as emacs. Good point. Even vi (before vim) had/has the abbr(eviation) command which can be used for things like expanding say bg into begin and so on. Plus, typing time is not the biggest part of programming time, not by a long chalk, though of course improving typing productivity can help some with overall programming productivity. Also, others have said in maybe this thread as well as other places, that Pascal's unambiguous syntax is one reason for the high compilation speed of Pascal compilers - which again aids overall productivity. [Used both Turbo Pascal and C a lot.]
- wainstead 9y ago> even though the strongest argument frequently was that its harder to type "begin/end" than "{/}". Which is a pretty lame thing and it's not too different from Ruby, to boot.
- carlivar 9y agoRuby supports braces, they just aren't used as often. I prefer begin/end so this is a feature to me.
- chubot 9y agoI don't think anyone really disagrees with you -- most people have problems with the syntax of Perl, C, and C++. Sure, they can get used to it, particularly with C because it's small, but the syntax isn't why they use the language. Somewhat surprisingly, I think Perl's syntax is one of the reasons that Python became popular. Perl can do pretty much everything Python can, and it came significantly earlier. Yet people gravitated toward Python. I wouldn't call Python "strongly restrictive", but I would call it "just right". It's terse without being unreadable. JavaScript syntax is also pretty sane (but there are many horrible parts to the semantics.) Ruby seems to be pretty nice in the common cases, but there are apparently gremlins lurking in corner cases. Python has only 1 or 2 syntactic gremlins I can think of (trailing comma, etc.)
- kibwen 9y ago> 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 coinciding with Ruby. While I do personally find Python more readable than Perl, I attribute its ascent more to the combination of the Web 2.0 gold rush demanding dynamically-typed languages for quick prototyping, Perl's apparent mid-2000s limbo due to Perl 5 vs Perl 6, the then-declining reputation of PHP and the shared hosting services which first popularized it, and the quality of Python's standard library (which made up for CPAN).
- wainstead 9y agoI 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.
- 9y ago