167 points · by bwidlar · 4y ago · 53 comments
And to answer the questions every Schemer will have, no the runtime doesn't yet support tail calls or continuations.
A Wasm target of the Chez/Racket compiler might be an easier way to get fast and proper evaluation in Web browsers.
TCO is technically in the ECMAScript specification (since 2015) but hasn’t been implemented across browsers or runtimes (with a few exceptions).
Dr. Axel has written a good explainer of TCO in the context of Javascript here https://2ality.com/2015/06/tail-call-optimization.html
Having this as guarantee allows all the control flow concepts to be reduced to recursion and function calls.
A kind of purity when we reduce a programing language to the basic set of primitives that provide the building blocks to create any kind of programming paradigm, this is in a way the beauty of Scheme, moreso than Lisp.
It has tail calls, continuations and even green threads (SRFI 18 compliant), and a decentralized module system that can load libraries directly from github and a JS FFI! See this paper for advanced examples that you can copy-paste to the REPL: http://www.iro.umontreal.ca/~feeley/papers/BelangerFeeleyELS...
Parenscript: https://cliki.net/Parenscript
You are working with shapes of data, not lines of text. Using tools like Paredit you can get into an incredible flow akin to that of Vi/Emacs mastery, with the added layer that you are moving entire blocks rather than single words (that may or may not end up being valid code).
This is really something you will get used to very quickly, and dare I say, learn to appreciate.
I don't think so. AFAICT, people do hate parenthesis, no matter how long they use Lips/Scheme. They just simply get used to the clutter.
Also, when writing code, you can spam ")" to close functions/expressions. It takes only few brain cycles if the editor highlights matching parenthesis. This makes it easier to move code around. Copy-paste-))))))...
People see trees and not parens. People who complain about parens are still stuck in the "code is text" mind set rather than the "code is a tree" mind set.
>Also, when writing code, you can spam ")" to close functions/expressions. It takes only few brain cycles if the editor highlights matching parenthesis. This makes it easier to move code around. Copy-paste-))))))...
We've had editors since the 1970s that can take you to where a matching paren is closed. You then copy/paste the whole function without needing to add or remover parens.
https://journal.stuffwithstuff.com/2013/07/18/javascript-isn...
How someone who supposedly liked, wanted and had experience with Scheme ended up creating a language with a function-scoped var binding construct, which then took twenty more years to finally get a block-scoped let.