Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(2012)

Also, I can't figure out what makes it silly?



This VM basically maps the SECD machine, directly to the underlying Clojure environment, which being Lisp, is very close to begin with. (Since SECD was first intended to implement languages like Lisp.)

So, I suppose perhaps silly in the same way that the one page Lisp definitions written in Lisp are a bit silly. They presume that you already have garbage-collected Lisp-like cells, for example. And even if you have that, you still can't really use it as a practical programming language.

Consider how it evaluates a variable in an environment: https://github.com/zachallaun/secd/blob/master/src/secd/mach... It's the simplest, and worst, solution -- iterate over the linked list from the start until you find the value you want. Performance degrades exponentially the more variables you have. In a more "serious" interpreter or compiler, you'd want to do a transform at some point, and slip in the value directly, if possible. And if not, you want to call out to a fast lookup method, like a hash table or balanced tree.


> iterate over the linked list from the start until you find the value you want

I know right, you would want to use two threads to iterate in both directions and capture the element for the current scope for faster iterations!

In practice, that lookup technique might not be an issue at all.


A mis-autocorrect from simple. The GitHub page has the word in the project title correctly as “simple”.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: