4 ms·
After realizing how easy it is to parse sexps, and how complex some language syntax rules have become [1], i’ve wondered why we tolerate such complexity. I’ve
by cellularmitosis 8y ago
After realizing how easy it is to parse sexps, and how complex some language syntax rules have become [1], i’ve wondered why we tolerate such complexity.
I’ve realized it’s because we are still stuck in a text-file-oriented way of writing programs. We are hand-editing the serialization format of our programs. All of these languages with complex syntax is an attempt to optimize around that use-case.
If we had better tools which allowed us to leave behind text-file-oriented programming, there would be no need for all of this complex syntax.
There would be a few other benefits as well. No one cares whether photoshop .psd files use tabs or spaces, or whether the curly brace should go at end-of-line or next-line, etc.
[1] https://github.com/ruby/ruby/blob/trunk/parse.y https://github.com/ruby/ruby/blob/trunk/parse.y
- munificent 8y ago> After realizing how easy it is to parse sexps Why should "easy for the machine" ever be a consideration for software used by humans? Surely "easy for the human" is the metric that matters. The entire point of having computers is so that can do hard things to make our lives easier. If rich syntax is easier for us to read and feasible for computers to parse, that's the right trade-off.
- cellularmitosis 8y agoI think the primary drawback of languages with complex syntax is the additional barrier to entry it creates for developers to write more tools for the language. Many more people have started a Scheme interpreter than their own C++ compiler. If we had better tools, we wouldn’t necessarily be limited to just one user-facing syntax for a language. The syntax could simply be a preference in the tools. My point is that as long as we are stuck in text-file-oriented thinking, no one is even thinking about these possibilities.
- munificent 8y ago> Many more people have started a Scheme interpreter than their own C++ compiler. And yet many more people are writing C++ code. Toolability definitely matters, but the empirical observation is that a relatively small number of tools for complex languages used by a large number of people seems to provide a lot of benefit. > My point is that as long as we are stuck in text-file-oriented thinking, no one is even thinking about these possibilities. Thousands of people are thinking about this. I've been reading blog posts and manifestos about the death of text-based syntax literally since the 90s. What I think most of those people overlook is that if you think programmers struggle to write text, you're really underestimating how much they would struggle to layout boxes and lines or do whatever other spatial/visual user experience you have in mind instead.
- mattnewport 8y agoThis is not a new insight and there have been a number of attempts to create programming systems where the programmer does not primarily interact with plain text but they have been largely unsuccessful. It would probably be worth exploring why they haven't taken off if one were trying to design another such system.
- cellularmitosis 8y agoThat's a great suggestion. Which attempts are you familiar with? The ones I'm familiar with are summarized in this talk: https://www.youtube.com/watch?v=K0Tsa3smr1w https://www.youtube.com/watch?v=K0Tsa3smr1w
- mattnewport 8y agoSome explorations of similar ideas that I'm aware of: - Intentional Programming: https://en.m.wikipedia.org/wiki/Intentional_programming https://en.m.wikipedia.org/wiki/Intentional_programming - Light Table: http://lighttable.com/ http://lighttable.com/ (inspired by some ideas from Bret Victor: http://worrydream.com/ http://worrydream.com/) - Visual Programming (lots of examples) - Literate Programming You can view sophisticated IDEs and refactoring tools as an attempt to improve the interface to plain text representations of code. These have actually had quite a bit of success. Some approaches that move away from editing code as plain text have had success in particular domains. Visual Programming has shader graphs, Houdini, Unreal Blueprints, Substance Designer and other niches where it is relatively successful. Literate Programming has Jupiter notebooks and Mathematica that are popular in certain domains. Most of the success seems to come in particular niches, it's hard to think of widely adopted examples for "general" programming. And Excel of course is a very successful non text based programming model within many domains.
- hyperpallium 8y agoNatural language is a serialization format, written and spoken. Algebraic notation is also serial. We like it, are good at it; get used to it. Assuming natural language is the serialization format of thought (quesionable), we could have non-serial program representation when we can interface directly with thought. \aside Chomsky reckons natural language is not primarily used for communication, but as an internal linkage between concepts and perception/action. If so, why is it serial? Is it serial? Is a grammar needed if it is not serial? Perhaps structure is all that is needed, and that does not require grammar (though fits with it, via AST).