3 ms·
If you use indentation for nesting, the closing tags are superfluous. That’s just one of the reasons so many html/xml template langs have chosen that format.
by doublerebel 2y ago
If you use indentation for nesting, the closing tags are superfluous. That’s just one of the reasons so many html/xml template langs have chosen that format.
- amelius 2y agoI came here to say this. Get rid of those closing tags.
- retorquere 2y agoBut then it would just be pugjs from the looks of it.
- mopires 2y agoIt's not identation based. Removing the closing tags would just not close anything. Everything would be immediately nested hehe
- mopires 2y agoRight... It's not identation based. Why remove the close tags?
- lolinder 2y agoHaving 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.
- diffxx 2y agoI 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.
- lolinder 2y agoHow do you propose a stricter syntax without redundancy for something like HTML where the problem domain is (mostly) arbitrarily nested elements?
- throw156754228 2y agoI 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.
- lolinder 2y ago"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 https://mw.lojban.org/index.php
- throw156754228 2y agoRead my message again, I'm not saying 'just don't do that'.
- lolinder 2y ago"Just test against visual regressions" sounds to me like "just look twice at the code you indented". Did I misunderstand?
- throw156754228 2y ago
- mopires 2y agoI'm not using identation. I'm actually using closing tags with a "/". For example: table [...] /table