23 ms·
You were downvoted because what you said shows that you do not understand what paredit is. I'd recommend you read https://en.m.wikipedia.org/wiki/Structure_edi
by didibus 9y ago
You were downvoted because what you said shows that you do not understand what paredit is.
I'd recommend you read https://en.m.wikipedia.org/wiki/Structure_editor https://en.m.wikipedia.org/wiki/Structure_editor to better grasp the concept.
If you've ever used the XML structure view in eclipse, its the Design tab, you get a better idea. In contrast to its source tab.
- dmitriid 9y agoLet's see. Here's the original text: > Rather than thinking in letters, words, lines, or paragraphs, editor modes like paredit let you edit in terms of the structure of your code So. My question is: which modern programmer thinks in terms of thinks about code in terms of letters, words, lines, or paragraphs? The truly antiquated tools (like vi and emacs) may still handle code as if it was just text. The actual code editing tools have long been able to deal with the structure of the code. And in ways that paredit may only dream of. > If you've ever used the XML structure view in eclipse, its the Design tab, you get a better idea. Erm. The only "think semantically" that paredit pretends it does happens only because Lisp has a rather regular syntax. It doesn't take much thinking or work to move parts of code in and out of parenthesis, or to be able to close a matching bracket. Actual modern tools know the structure of the code and offer much greater editing and code handling capabilities than that. Edit: As a trivial example. Here's IntelliJ and PHP code (yes, PHP). It understands the code, it's structure, and offers context based editing help based code structure and semantics: https://dmitriid.com/i/gm2tmnztha4tenjq.png https://dmitriid.com/i/gm2tmnztha4tenjq.png Speaking of semantics. Unlike the dumb "move things in out of brackets" the actual tools understand semantics of code. Once again, this is PHP (!), and the tool knows about the semantics of code: https://dmitriid.com/i/gm2tmnbtga4tanjs.png https://dmitriid.com/i/gm2tmnbtga4tanjs.png Editing capabilities available to some other languages would blow your mind.
- didibus 9y agoYou were probably downvoted too because you keep assuming other people talking about structural editing have never used IDEs for Java, php, C++, C#, etc. Nothing is blowing my mind, structural editing is different from what you're talking about, and enables different benefits and also downsides then those. I think the wikipedia article I linked does a good job at explaining the distinction: > editors in some integrated development environments parse the source code and generate a parse tree, allowing the same analysis as by a structure editor, but the actual editing of the source code is generally done as raw text.
- dmitriid 9y ago> You were probably downvoted too because you keep assuming other people talking about structural editing have never used IDEs coming from a person who also wrote this: > You were downvoted because what you said shows that you do not understand what paredit is. > I'd recommend you read ... to better grasp the concept. So, people keep assuming that I for some reason have never tried paredit (or written anything in Lisp). So why don't I give you a taste of your medicine. I suggest that you go and read some documentation on the IDEs I mentioned and try and use them to better grasp the concept. Paredit is a very dumb tool that only works because Lisp's syntax is regular. There's nothing semantic or structural about the ability to move some words in or out of parentheses or to close matching brackets. Other languages might not have the same wondrous ability simply because their syntax is more complex. Their tools though clearly allow much better actual structural editing and actual semantic reasoning about code.
- didibus 9y ago> So, people keep assuming that I for some reason have never tried paredit (or written anything in Lisp) If you have, its surprising that you believe IntelliJ's PHP editor to be a full structural editor then. > Paredit is a very dumb tool that only works because Lisp's syntax is regular. There's nothing semantic or structural about the ability to move some words in or out of parentheses or to close matching brackets. 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. So in return its a benefit. That's why a lot of simple regular syntax languages like XML often have structural editors for them too, because of how easy it is to make one. > Other languages might not have the same wondrous ability simply because their syntax is more complex. Their tools though clearly allow much better actual structural editing and actual semantic reasoning about code. I'm not saying that certain IDEs for certain languages don't offer great features which allow edits to be made in ways that are semantically aware and maintain syntactically valid structure. I'm saying that those languages don't offer full on structural editors of their code. So when writing and editing the code, you do so as text, without taking structure into account. Yes, your syntax errors will be highlighted, yes you can perform certain structural refactorings, but the editor is textual and not structural. If you have experienced both, it should be pretty obvious that they feel and are very different. I don't claim one to be better then the other, I think both are great, but it also depends on the language. If Java had a structural editor it might be more annoying then it'd be helpful. For Lisps it is amazingly useful, more so then what IntelliJ does for PHP. With Lisps, I'd rather have paredit then a background AST which allows me refactorings, auto-complete and error highlighting. But off course, those are fortunately not mutually exclusive and I have those also.
- lazyasciiart 9y agoCan you explain it? For instance in IntelliJ I can refactor and have it automatically replace only instances of the word "call" that are actually invocations of the function call(). That's structured editing, not text-based.
- didibus 9y agoYea, that's true, but your editor pane is a text editor non the less. The refactoring in this case is structured, even more so, its semantically accurate to a specific language. But your editor isn't. A structural editor does not allow you to make edits that would go against the syntax rules of your language.
- dmitriid 9y ago> your editor pane is a text editor non the less And the editor pane with paredit somehow becomes a magical structural editing machine? Paredit knows exactly zero things about your code. The only thing it can do is match brackets/parentheses and move code between them. That's it. In an actual code editing tool that actually understands code structure and semantics, I can: - select and move semantically and structurally valid blocks of code - extract parts of code into a separate variable - extract parts of code into a separate function - extract parts of code into a separate module - safely rename variables and functions across multiple files - simplify/split/extract/generify code - ... many more ...
- jyounker 9y agoI'd argue that IntelliJ is a structured editor. If you look under the hood the entire system is build around a tree-representation of the code. The "text editor" is a thin varnish on top of that syntactic representation.
- lazyasciiart 9y agoIt sounds like you're saying a tool can only be a structural editor if it doesn't do anything else. I want an editor that can operate structurally AND as a text editor - I don't write new code as syntactically complete units in one keystroke.