Hacker News new | ask | show | jobs
by sixthDot 980 days ago
> But these days folks are mostly used to the C style syntax. And I'm not even arguing that it is a better language than C or others. But the whole industry has gone overall into believing that anything newly 'invented' is good and anything that's been around a while is passé

Problem of the Pascal syntax is that it prevents adoption of certain constructs, which are just not nice. A few examples

- lambda expression: `begin` ... `end`, say goodbye to nice one liners;

- binary assign: FPC has `+=` `-=` but obviously not `mod=`, `and=`, etc;

On top of that there are other things like

- shortened boolean evaluation (e.g `if someInt` => `if someInt != 0` is not possible because `and` is a two headed creature

- locals are still not default initialized

I use to like Pascal (actually Delphi then ObjFPC) much but nowaday I think the only good parts are in certain semantics, e.g no fallback in the `case`...`of` construct, manual memory management BUT ref counted arrays.

I would tend more to like a C like syntax with certain semantics coming from the Pascal world.

4 comments

The problem with "one liners" and other coding is that its generally to clever. One of the things I like about python (despite not liking it that much) is for certain constructs there is "the one true way", for example the required formatting trains people to all read the same code. With C/etc languages there are dozens of different but in the end identical ways to express and format the same construct its crazy. And it creates unnecessary mental overhead, nevermind the if..fi..else ambiguities that aren't even standardized behavior.

So, much of what you are complaining is largely pointless syntactic sugar issues, like people complaining about the difficulty of typing "begin" vs "{" when any modern editor can autocomplete, and nevermind the difficult parts of programming are rarely the limit on how fast one can type 5 characters vs 1. I might even go so far as to say, slowing down a bit probably actually increases the code quality.

(PS: I've programmed professionally in pretty much every mainstream language and quite a number that aren't mainstream. IMHO Object Pascal strikes a far better balance of performant code, ease of development and maintenance, and developer safety than most of the languages in modern use, maybe all of them. Its frankly a shame that more places don't take it more seriously and would rather invent yet another poor half baked language that takes another few thousand man years of effort for the compiler writers and the users to overcome as they are discovered).

> - lambda expression: `begin` ... `end`, say goodbye to nice one liners;

If there's one thing I would eliminate from programming, despite their benefits, is the one liner lambda expressions. It has turned clean, readable Python code into muddy statements I need to pause to compile in my head to understand.

I am not a fan.

BEGIN/END needn't be a showstopper for one-line lambdas. Ruby has nice one-line lambda expressions where you can substitute `{` ... `}` for `do` ... `end`. A Pascal implementation can't do exactly that, but it could use an alternative syntax.
elixir allows one-line lambdas with `fn ... end`. they don't look as nice as they would have with braces but the parser handles them fine.