4 ms·
For another way of removing indentation needed for structure. Make python a lisp - indentation is just the number of brackets. Hy - http://hylang.org http://h
by pasc1878 2y ago
For another way of removing indentation needed for structure.
Make python a lisp - indentation is just the number of brackets.
Hy - http://hylang.org http://hylang.org
- blharr 2y agoI feel like this is a great idea, but as with other lisps, it looks really unfamiliar and loses the simple readability that python has for me.
- perrygeo 2y ago> it looks really unfamiliar Swahili looks unfamiliar to me. Because I didn't grow up in southern Africa. Don't conflate subjective familiarity with objective simplicity - any "unfamiliar" concept only reflects on you, not your subject.
- goatlover 2y agoBut millions of people are already familiar with existing Python syntax. Changing that would make it unfamiliar to them, and that's when you get people switching to another language that looks more familiar to them. Which is why C-style syntax has been so popular.
- pasc1878 2y agoNo one is suggesting changing it. This whole thread is about an alternative syntax for python. I was pointing out that there is yet another alternative. I prefer lisp syntax over indentation aware (e.g. python) over block syntax and at the bottom ones that force semi colons on you (the end of line is sufficient) - so the OP syntax for me is a massive downgrade of the language. Somewhere in that list I would add APL near the top but can't quite categorise it.
- xigoi 2y agoLisp-style parentheses are still better than brackets because at least they don’t waste verticat space. (if x (if y (if z foo))) versus if (x) { if (y) { if (z) { foo; } } }
- kazinator 2y agoBraces can be formatted in a Lisp-inspired style! Try it like this: if (x) { if (y) { if (z) { foo; } } } The rules are a little different. We have two-space indentation, like what is favored in Lisp, but there is a space after the opening brace. For symmetry, we put spaces between the closing ones. It works best if we don't "cuddle" the opening brace but put it on a new line. There is a rhyme and reason to it, and consistency. I've written some C programs that way, though not recently and can't point to any online examples. However, I also wrote, and maintain, the Yacc grammar file in TXR Lisp in this style (just the actions in the grammar portion). For whatever reason, it works well in grammar files. https://www.kylheku.com/cgit/txr/tree/parser.y https://www.kylheku.com/cgit/txr/tree/parser.y
- pasc1878 2y agoBrackets are these () - so lisp {} are braces This is English English