3 ms·
Let'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 str
by dmitriid 9y ago
Let'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.