Conversation

Factor's core syntax was even simpler than Smalltalk. You have numbers, words, and string literals!. That's it (just one more concept than Forth!) Even local variables were implemented as a library. That's cool right? Well, it sounded cool at first, but we ran into problems 1/n
Quote Tweet
I understand there are cool things enabled by Swift, but there are cool things in all these languages. Smalltalk's entire syntax fits on a postcard and is as cool as anything. The hardest part of programming is reading and understanding other people's code. Optimize for that.
Show this thread
4
44
Locals would expand into stack shuffling, basically. The 'walker', which was a primitive debugger of sorts, didn't know anything about locals, so you would end up walking through the expanded stack code, which was unreadable.
2
6
There was another "language extension in a library" called 'fry', for partial application; eg { 1 2 3 4 } '[ _ 1 + ] map Guess what, fry didn't always compose with locals either, even though there were some hooks so that one knew about the other (I forget which direction)
1
2
Since locals expanded into (very verbose, more verbose than what a human would write) stack shuffles, compile time started to become an issue as well. The compiler converted stack code to SSA form, effectively undoing the locals transform.
1
2
At this point, I added some special compiler primitives to allow locals to bypass stack shuffling and generate more efficient SSA code. More and more libraries in the base system started to depend on locals, too. It basically became a language feature, except weird and broken
1
2
The whole debate about what's built in to the syntax/semantics/compiler -vs- what's implemented in a library is a distraction. A compiler can just as easily desugar funny-looking syntax into orthogonal internal representations -- or not
2
14
A pile of language extension macros in your Forth/Lisp/Factor could be well-architected to expand into a nice set of simple primitives that work together well and support your tooling -- or not
1
14
As for the human reading the code, I used to be a minimal syntax extremist, but now I'm not so sure. A homogeneous soup of s-expressions or concatenative code where everything looks like a nested tree of symbols isn't clearly better than special syntax for common idioms concisely
4
37