Speaking from personal experience, Scheme looks deceptively simple but it is one of the hardest languages to write a compiler for.
I say this mainly because of 2 things:
1. Hygienic Macros (You practically have a whole another language inside the language)
2. First Class Continuations (There is no good way to achieve this other than doing a CPS transform on the AST)
maplant · 1h ago
CPS transforms are not the only way; if you translate the scheme to bytecode for a virtual machine, the call stack and IP can be reified.
But yes, for a compiler specifically, you need a CPS transformation
bjoli · 33m ago
CPS transformation is a good thing to do anyway, no? Then CPS your CPS and you have delimited continuations.
bjoli · 34m ago
You should all have a look at Oleg Kiselyov's speech about continuations at Dan Friedman's 60th birthday. That is some next level shit.
shawn_w · 56m ago
Bug: The `list-iter` function presented assumes that an empty list is false. While that's the case in Common Lisp, it isn't in Scheme (and hasn't been in a very long time; iirc in early versions it was optional behavior).
I say this mainly because of 2 things:
1. Hygienic Macros (You practically have a whole another language inside the language)
2. First Class Continuations (There is no good way to achieve this other than doing a CPS transform on the AST)
But yes, for a compiler specifically, you need a CPS transformation
https://people.csail.mit.edu//jhbrown/scheme/