TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Programmer Tooling Beyond Plain Text

109 点作者 kenpratt大约 10 年前

19 条评论

BoppreH大约 10 年前
I&#x27;ve been working on a Structured Code Editor for a couple of years:<p><a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;wvcduDk.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;wvcduDk.png</a><p>(in the picture above &quot;string&quot; is selected, and &quot;find&quot; is slightly highlighted because its on the same level. this helps visualize the tree and plan your movements)<p>It actually started as my final project during undergrad. Here&#x27;s my 78-page thesis on it (unfortunately Portuguese, but has English pictures):<p><a href="https:&#x2F;&#x2F;projetos.inf.ufsc.br&#x2F;arquivos_projetos&#x2F;projeto_1398&#x2F;editor-estruturado.pdf.1" rel="nofollow">https:&#x2F;&#x2F;projetos.inf.ufsc.br&#x2F;arquivos_projetos&#x2F;projeto_1398&#x2F;...</a><p>Structured editing is much, much, MUCH better suited for programming than plain text. Syntax preservation and source-display separation are game changers, and they are not the only benefits.<p>Unfortunately it has a Vim-level difficulty curve and people don&#x27;t realize how much time they currently waste on syntax mucking. This makes marketing kinda hard, even with a fully operational and well polished implementation.<p>Fun fact: structured editing also works with non-programming structured text, like JSON, HTML and CSS!
评论 #9496334 未加载
评论 #9495854 未加载
评论 #9497529 未加载
评论 #9496456 未加载
评论 #9507404 未加载
jameshart大约 10 年前
The very first programming text editing interface I ever used was the ZX Spectrum&#x27;s BASIC editor. The Spectrum had a peculiar modal entry system, where entering any keyword was always a single keypress. The keyboard had all the BASIC keywords written on and around the keys (see <a href="http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ZX_Spectrum#&#x2F;media&#x2F;File:ZXSpectrum48k.jpg" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ZX_Spectrum#&#x2F;media&#x2F;File:ZXSpect...</a>).<p>As you typed a BASIC command, the cursor would switch between being a flashing &#x27;K&#x27; (keyword entry mode: the next key you press will enter the white keyword on that key), or in expression entry mode, a flashing &#x27;L&#x27; (lowercase letter entry) or &#x27;C&#x27; (capital letter entry). Other keywords were accessible using the &#x27;Symbol Shift&#x27; key (to enter the symbols or function names in red on the key caps), or by pressing symbol shift and shift you could put it into &#x27;Extended&#x27; mode and enter the red or green keywords above or below the keys.<p>The upshot of this was that Spectrum BASIC never had to lex code outside of basic expression parsing - and the only ASCII lexing it had to handle was expressions containing literals and variable names. Any keyword token was stored just as a single character token in memory - the program was stored tokenized and ready to be interpreted. It was fundamentally impossible to type certain classes of syntax error.<p>I remember being kind of surprised when I came across the BBC Micro and C64 where you had to <i>type</i> BASIC keywords out in full. It felt crazy - how could the computer handle you mistyping &#x27;prnit&#x27;? How come the computer let you type lines of BASIC in that were wrong?<p>I still think there&#x27;s something slightly broken about the fact that text editors let you type syntactically invalid code.
评论 #9497329 未加载
smarks159大约 10 年前
The most complete example of a structured editing system I know off is Doug Engelbart&#x27;s NLS system from the mother of all demos (from 1968!) [0]. In the system text, drawings and code are all structured hyperdocument data. It is quite different from most software we use today. As seen from the demo, structured editing works well not just on code but on also on text.<p>I have been experimenting with implementing some of these ideas in the browser[1]. I primarily use the system to take text notes with and write down my ideas. You can&#x27;t program in it yet, but part of the program is driven by datastructures that are created, edited and manipulated in the system itself. Instead of looking and manipulating the raw data, however, you can render the data to look like a pseudo dsl.<p>[0] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=yJDv-zdhzMY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=yJDv-zdhzMY</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;smarks159&#x2F;hyperdocument-system-wiki" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;smarks159&#x2F;hyperdocument-system-wiki</a>
melloclello大约 10 年前
I&#x27;ve long felt that a proper structured editor would work somewhat like a tree editor[1]. Code is trees, right?<p>[1] <a href="https:&#x2F;&#x2F;pcmonk.wordpress.com&#x2F;2014&#x2F;04&#x2F;01&#x2F;why-dont-we-have-a-general-purpose-tree-editor&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pcmonk.wordpress.com&#x2F;2014&#x2F;04&#x2F;01&#x2F;why-dont-we-have-a-g...</a><p>If you had a really good, intuitive tree editor, I would imagine it would be easily adaptable to all kinds of interfaces and scenarios. Mobile, web, VR...
评论 #9496538 未加载
评论 #9495775 未加载
评论 #9496593 未加载
ori_b大约 10 年前
I&#x27;ve been hearing this sort of thing for years (decades?), but I have yet to see someone put a toolchain together that works well using these concepts. It would be interesting to see someone try it instead of just talking about how it would be a good thing.
评论 #9495810 未加载
wyc大约 10 年前
The notation section reminded me of what good tools APL&#x2F;J&#x2F;K&#x2F;Q were for dealing with matrices:<p><a href="http:&#x2F;&#x2F;jsoftware.com&#x2F;help&#x2F;dictionary&#x2F;vocabul.htm" rel="nofollow">http:&#x2F;&#x2F;jsoftware.com&#x2F;help&#x2F;dictionary&#x2F;vocabul.htm</a><p>Instead of Mat.Inverse(), there&#x27;s an operator that actually means &quot;take the inverse of this matrix&quot;. Likewise, the power operator in J, if given infinity as the exponent, will apply a function to a value until the fixed-point is reached. Haskell&#x27;s infix operators also steer towards this direction of expressiveness.<p>It&#x27;s pretty liberating to be able to use programming symbols to represent computations in the same way the integral symbol represents integration. However, the barrier to literacy is inevitably raised.
WalterGR大约 10 年前
<p><pre><code> With previously working code above and below, I start to declare foo. In the process I introduced unmatched ‘{’; &#x27;(&#x27;; and &#x27;&quot;&#x27;, and am referencing the not yet (fully) declared foo. This is routine editing, but it causes huge problems to tools like * typechecking * go to source * code folding * autocomplete * etc </code></pre> Visual Studio and C# aren&#x27;t without problems, but they are without this problem. This works fine.[1] I&#x27;d be quite surprised if it didn&#x27;t also work in VS-supported languages such as VB.net, F#, and JavaScript - but I can&#x27;t attest to it.<p>[1] - I personally find it annoying that VS complains about unmatched punctuation the moment I insert the opening one. &quot;Jesus, VS, give me a minute!&quot; And there are other parts of VS and&#x2F;or C# that I (and probably you) find annoying. But the above is a Solved Problem, if you choose your tools carefully.
评论 #9496879 未加载
vezzy-fnord大约 10 年前
The title made me think it was going to be about Smalltalk images, but it was actually a tad less ambitious than that.
davidshepherd7大约 10 年前
Related: there are a few emacs plugins that can do structural editing for lisps.<p><a href="http:&#x2F;&#x2F;danmidwood.com&#x2F;content&#x2F;2014&#x2F;11&#x2F;21&#x2F;animated-paredit.html" rel="nofollow">http:&#x2F;&#x2F;danmidwood.com&#x2F;content&#x2F;2014&#x2F;11&#x2F;21&#x2F;animated-paredit.ht...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;Fuco1&#x2F;smartparens" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Fuco1&#x2F;smartparens</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;abo-abo&#x2F;lispy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;abo-abo&#x2F;lispy</a>
fizixer大约 10 年前
In some sense pointing out &#x27;text&#x27;ness of the text tools is the wrong thing to do (e.g., &#x27;text&#x27; is something that contrasts with &#x27;binary&#x27;). All of Excel, LabView, Scratch etc (as jamii pointed out in the other comment, as examples of structured editors), could have text file formats behind the scenes which could still be diffed, grepped etc. (unless the author made the distinction between text and ASCII&#x2F;Unicode).<p>I think the author has made an interesting point, but I would add that &quot;time has come&quot; to, not abandon text tools (which I don&#x27;t think has worked; I think the trend is going away from Excel to R and python+pandas, in data science etc), but have a hybrid system, where the text representation of the &quot;view&quot; is visible to the programmer all&#x2F;most of the time.<p>For example:<p>- we either have plain text &quot;LaTeX&quot; editing where we edit out document&#x2F;source &quot;blindfolded&quot;, and only get to see the result when we compile and view the pdf.<p>- we use a WYSIWYG tool like Word (and some WYSIWYG LaTeX editors) where we stick to the view and are scared (sometimes it&#x27;s impossible) to dig into the text representation<p>- what we need is something like a hyprid, where a &quot;view&quot; line, and a &quot;text&quot; line are interweaved, or &quot;view&quot; on left side, and &quot;text&quot; on right side. And we could edit any of the two ways, and the other should update.<p>I&#x27;ve been thinking along these line for quite a while, and if I get a change I intend to create some kind of system based on that.
评论 #9496471 未加载
rwallace大约 10 年前
This article makes exactly the same mistake that pretty much everyone else suggesting programmer tooling beyond plain text has made: assuming it has to be either or, that if we want more sophisticated tools that use a more complex representation, we have to give up text.<p>The suggestion is a nonstarter. Network effects alone would prevent the world making such a move, and it&#x27;s a good thing, because the loss wouldn&#x27;t be just a particular existing tool, it would be the entire universe of tools that work with text, that the world has spent decades developing, most of which any individual has never even heard of, let alone thought about how to replace.<p>It&#x27;s also completely unnecessary. If you want a tool that lets you view and edit your code in a fancy table format, you can write one. All it needs to do is parse the existing source code into whatever internal format it wants and write it out again afterwards. Yes I know the author criticizes parsers, but really, writing reliable parsers has been done often enough to make it clear that it&#x27;s a solvable problem. And would it not be better to have some of what you&#x27;re looking for in an actual tool than all of it in an imaginary one?
collyw大约 10 年前
Its probably because I have spent way more time in front of an IDE than in (advanced) maths classes that I find the code example vastly more readable. I had no idea what the Integral symbol on the left meant, while the function name makes it obvious. Likewise the parenthesis make it easy for me to understand what gets parsed first.
westoncb大约 10 年前
I was working on a text-free structural editor a couple of years ago which people seemed to like (and probably now think of as vaporware). I was writing it under kind of ridiculous conditions, though, and needed to take a break. I&#x27;ve moved its project page here recently (with video): <a href="http:&#x2F;&#x2F;symbolflux.com&#x2F;projects&#x2F;tiledtext" rel="nofollow">http:&#x2F;&#x2F;symbolflux.com&#x2F;projects&#x2F;tiledtext</a><p>I head a realization a couple weeks ago about how to simplify some core pieces (which were making undo&#x2F;redo... insane), and started getting back into the code. I wish I could dedicate myself to working on it full-time, but I need to be cautious about coding too much. So, it&#x27;s either I work a shitty minimum wage kind of job, or don&#x27;t really do side projects. Thinking of leaving professional software again in order to keep the side projects :&#x2F;
coliveira大约 10 年前
colorForth adds at least the color dimension to a programming language. Words have different meaning depending on the color used. This reduces the amount of punctuation and the need for &quot;reserved&quot; words as we see in traditional languages.
评论 #9495935 未加载
toolslive大约 10 年前
One of the advantages of Structured Code Editors is that you don&#x27;t have to store plain text, you can use a code per construct. I guess this is one of the reasons the Sinclair Zx81 (1KB RAM) used a structured editor.
peter-fogg大约 10 年前
OK, let&#x27;s talk about parsing.<p>The article claims that parsing isn&#x27;t necessary with structured editing. We&#x27;re working on some abstract data structure representing our language&#x27;s syntax. This might be an AST, like any programming language in common use today, or maybe in the future we&#x27;ve thought up some better way to represent programming languages within the compiler&#x2F;interpreter. Since we&#x27;re working directly with the AST or whatever, we don&#x27;t need to parse! We just do whatever actions the programmer wants do over on our data structure.<p>Now, let&#x27;s talk about how parsing works in your language of choice in 2015. We&#x27;re going to take a string, and we&#x27;ll turn it into a representation of our program. If we&#x27;re lucky, our language implementation isn&#x27;t awful, and our parser will be a function from some sort of Unicode-encoded text into an AST. OK, maybe our input is ASCII or some other text encoding, but the point is the same. Either way, we&#x27;re taking some keypresses from the programmer, and turning them into a data structure representing the program.<p>Let&#x27;s abstract a bit. Maybe in the future we don&#x27;t use keyboards. Instead, we have whatever peripheral you like. This peripheral is capable of sensing some sort of action from the user, and turning it into actions within the computer. So now, our parser is a function from some user action to a data structure representing the program.<p>This sounds an awful lot like &quot;we just do whatever actions the programmer wants do over on our data structure&quot;. The question is, how do we figure out what the user wants? The answer is, we parse it! It doesn&#x27;t matter if we&#x27;re parsing text or not. We will <i>always</i> need some way of determining the programmer&#x27;s intention from the signals we get through their peripheral device. Viewed through this lens, the camera requires a parser just as much as the keyboard does, just as much as the mousepad does, just as much as the microphone does. We will <i>always</i> need a way to convert the unstructured thoughts of a human programmer into the formal language of a compiler&#x27;s internals. Regardless of what representation we choose for any part of this process, it&#x27;s going to be subject to the article&#x27;s quote:<p>&gt; This situation is a recipe for disaster. The parser often has bugs: it fails to handle some inputs according to the documented interface. The quoter often has bugs: it produces outputs that do not have the right meaning. Only on rare joyous occasions does it happen that the parser and the quoter both misinterpret the interface in the same way.
评论 #9496940 未加载
m_mueller大约 10 年前
Ever since I&#x27;ve seen &quot;subtext&quot;[1] I&#x27;ve been interested in tables for programming. I highly recommend checking that out.<p>[1] <a href="http:&#x2F;&#x2F;www.subtext-lang.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.subtext-lang.org&#x2F;</a>
jesstaa大约 10 年前
The most interesting thing I&#x27;ve seen in this space recently is <a href="http:&#x2F;&#x2F;peaker.github.io&#x2F;lamdu&#x2F;" rel="nofollow">http:&#x2F;&#x2F;peaker.github.io&#x2F;lamdu&#x2F;</a>.
kpmah大约 10 年前
I&#x27;ll throw in my work in this area: <a href="http:&#x2F;&#x2F;sediment.io" rel="nofollow">http:&#x2F;&#x2F;sediment.io</a>