
Lisp in Dart 2.0 - tosh
https://github.com/nukata/lisp-in-dart/blob/master/IMPLEMENTATION-NOTES.md
======
decafbad
"Tail call optimization, which also implies tail recursion optimization"

I thought those were exactly same thing.

~~~
patrec
In a language with guranteed tail call optimization, the below consumes no
stack, although there's no recursion.

    
    
        def f(a):
           return g(2*a)
    
        def g(a):
           return a + 1

~~~
cwzwarich
How does your definition distinguish between stack space used for call frames
and stack space used for storage of temporaries? It's not possible to capture
the difference without an asymptotic property, which wouldn't matter in this
case because there's a constant number of function calls.

~~~
codebje
There's no difference.

When you exit a function, you must clean up local stack allocations. It
doesn't matter if you exit with a return or a jump. It doesn't matter where
you jump. If you leave the stack with temporary allocations in place, they'll
leak space.

(A compiler pipeline may, at some point, observe that releasing stack space,
jumping, then claiming the same amount of stack space could be optimised to
just a jump, but it may equally observe that releasing, jumping, and claiming
a different amount could be optimised to either releasing or claiming the
difference, then jumping, too - there's still no difference between recursive,
co-recursive, and non-recursive tail calls.)

------
ac130kz
I have only one question: what is the purpose of this stuff? Was it made to
extend the possibilies of Dart?

~~~
indigo747
It looks like it was for fun. The author has several repositories on Github
holding Lisp interpreters in different languages. It might also be a learning
technique: interpreters for higher order languages are good intermediate
projects when learning new languages.

------
stewbrew
"A sort of subset of Emacs Lisp, but being Lisp-1 with lexical scoping"

Couldn't we please base such things on scheme or clojure (for Lisp-1) or
common lisp (for Lisp-2).

