Hacker News new | ask | show | jobs
by lolinder 694 days ago
Having used Jade and YAML and Python extensively, I disagree.

Natural languages have redundancy because they're often used in cases where transmission is imperfect. The redundancy provides enough information to piece the meaning back together even if the distortion is high.

A similar example of redundancy is the check digit on a credit card number. You could save some space by eliminating it, but then simple human error can cost people a lot of time and money.

The same principle applies to programming languages. They most commonly get distorted through copy/paste and through modification in adjacent code. Sometimes those distortions create a result that is syntactically invalid, which is the best case scenario and gives you a chance to piece it back together. But the more flexible your syntax is and the less redundancy it has, the harder it is to recover from errors. The distorted code can look correct.

Closing tags and curly braces give extra redundancy to a language which can allow for better error recovery in the case of distortion. They're the check digits of programming: they're not exciting or flashy, but they provide a layer of safety to sharing and modification.

4 comments

That is a very interesting argument and very well presented. It gave me something to think about. Although, have in mind that this is a markup language. It's not a script language where you will make complex logic. It's intended to make visual elements. I do not intend to add logic implementation to it, like a template engine(ifs, loops,...). The incoming features are for visual elements implementations, like built in clip paths configuration.

I see now that the way I present it is vague. In future post I'll improve the presentation of it.

Thank you for you attetion to detail and for the argument. As humans we are prone to error. With that in mind I think this can be a valuable addition to the markups.

Thank you!

I personally a prefer a stricter syntax with less redundancy. With a sufficiently fast and accurate compiler, things like indentation issues can be resolved very quickly when there is a copy/paste issue.
How do you propose a stricter syntax without redundancy for something like HTML where the problem domain is (mostly) arbitrarily nested elements?
Closing tags and curly braces are only redundancy if the compiler/interpreter looks at both them and at the whitespace. I don't think any existing languages do that.
No, they're redundancy either way because both sets of syntactic elements communicate to you.

It'd be even better (in this way at least) if the compiler required they match, but you are also a parser.

I think in a nutshell you are saying a developer could accidentally hit tab one too many times. Just test against any visual regressions, it's not hard.
"Just" don't do that is easy to say, but it's better to design the language to make it easy to catch mistakes.

The urge to remove delimiters is the lojban impulse [0] applied to programming languages. It's elegant and clean and impractical.

[0] https://mw.lojban.org/index.php

Read my message again, I'm not saying 'just don't do that'.
"Just test against visual regressions" sounds to me like "just look twice at the code you indented". Did I misunderstand?
What I mean is this code should be tested like any other, using visual testing suites like playwright or cypress.
Got it.

My opinion is that if your answer to a deficiency in the language's syntax is to just test harder you're missing something. Quick feedback loops are essential, and the quickest feedback loop at all is having a syntax where it's immediately obvious to the human looking at the code (before analysis is even run!) when there's a problem.