2 ms·
> Yes, it is a very dumb tool, but because Lisp's syntax is so simple, it makes implementing a structural editor for it trivial like that. Tell me if it helps
by xfer 9y ago
> Yes, it is a very dumb tool, but because Lisp's syntax is so simple, it makes implementing a structural editor for it trivial like that.
Tell me if it helps you use the loop macro correctly? Paredit only helps you with brace-matching, it doesn't (can't) understand about the semantics of your s-expr and hence not that useful without additional tooling. For other languages the brace matching problem isn't that bad that you need paredit-like tools.
- didibus 9y agoCorrect, structural editing is about structure and not semantics. Paredit does help with the loop macro, it helps you write it in a structurally correct way based on the language's syntax rules. Structural editors just make sure your code will parse, not that it is semantically correct. It doesn't know the meaning or behaviour of the loop macro, but it does know how to properly structure it so it can be parsed. And so it gives you ways to add, remove and restructure elements of your code such that it will always be valid for your language. Lisp syntax is really simple, so yes, you don't need much out of your structural editor. Just make sure everything is balanced at all times and allow you to move symbols in and out of parenthesis, and change their order and nesting. That's all you need to guarantee proper structure of Lisp code. Now, in Lisp, if you used a normal text editor, you'd quickly start to have wrongly balanced forms, you'd be annoyed at how you keep having to shuffle so many things around just because you want to now divide a whole form by 5 or change the order in which two things are performed. Using a structural editor will remove all these pains, and suddenly, its even easier to do these things in Lisp then it is in say Java. Whereas without structural editing, it was way easier in Java. So Java + text editor = Never had issues structuring and restructuring code. Lisp + text editor = Omg, I hate all the parenthesis and nesting and prefix notation because it makes structuring code painful. Lisp + structural editing = Everything I found difficult with a text editor is now not only easy, I find that its even faster and easier to restructure the code then when I use Java with a text editor. Java + structural editing = I don't know, because Eclipse, Netbeans and Idea do not provide structural editors for Java that I know off. I suspect it would not be as game changer as in Lisp, since java + text editor is already satisfactory. Everyone who says that structural editing isn't useful, and what is way more useful is code refactoring tools is just missing the point. Code refactoring is useful, but in Lisp, so is structural editing. You could even debate it is more useful. Different language have different pain points, and so require different tools to address. I agree, I'm not looking for a Java structural editor, but its also hard to go back to editing Java after having mastered structural editing of Lisp code. The same way that its painful to rename a variable in Lisp once you've done it in Java using a good code refactoring tool.