Re:LSP could have been better
by Calavar on Friday October 13, 2023 @03:09AM
(#37867674)
Sure, you could do that. But how does it help you understand the code better than reading it in the original source form? Programming languages are more than syntax. If you don't understand the semantics, you don't understand the code.
[ Parent
| on HN ]
Re:LSP could have been better
by fiddlerwoaroof on Friday October 13, 2023 @04:14AM
(#37868122)
Different syntaxes are better for different purposes: s-expressions are easy to manipulate structurally; significant indentation is often easier to read; etc. Semantics is important, but syntactic noise is too.
You mean different purposes by humans or different purposes by machines?
For machine manipulation, I think it makes more sense to directly manipulate the AST.
For human manipulation, I think the cognitive overhead of mentally converting between the display syntax and the canonical syntax would far outweighs any gains in readability. But maybe your workflow is different than mine - If you have a lot of custom macros in your editor, I could see s-exps being useful (although, again, I think exposing and directly manipulating the AST would be less error prone)
Re:LSP could have been better
by fiddlerwoaroof on Saturday October 14, 2023 @05:16PM
(#37884343)
A programming language doesn’t need a canonical syntax if its semantics are specified in terms of the data-structures the parser produces and not in terms of the textual representation of those data structures.