[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How the backquote and the comma really work?
From: |
Michael Heerdegen |
Subject: |
Re: How the backquote and the comma really work? |
Date: |
Wed, 22 Jul 2015 00:08:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Marcin Borkowski <mbork@mbork.pl> writes:
> Stupid me – again;-). No wonder ‘mci/read-list-contents’ appears twice,
> once, once in ‘mci/read’ and once in ‘mci/read-list-contents’ – it seems
> there’s no other way (though I can’t prove it formally).
I don't think every implementation needs to have it in two different
defuns.
> But now my problem is something different, and on a different level –
> a “metaproblem” in a sense. I’m still working on ‘mci/eval’; it now
> supports ‘progn’ forms and ‘setq’, and I have ‘cons’, ‘car’ and ‘cdr’ as
> symbols bound to their Elisp counterparts in the global environment of
> my MCI, and when I have lambdas (and write ‘mci/apply’, which should be
> relatively easy now), I’ll have more or less complete (though tiny)
> Lisp. I guess that adding backquote should be really straightforward
> then.
>
> So where’s the problem? Well, it’s quite a lot of fun to put it all
> together, and I’m learning a few things along the way, so it’s difficult
> to resist the temptation to add more stuff. Macros? ‘cond’ forms?
> ‘while’ forms? OTOH, my goal is *not* to recreate all Elisp (contrary
> to Scheme, Elisp is far from minimalistic, for instance, it has *a lot*
> of special forms which could, in principle, be macros - ‘if’, for
> example, or ‘let’, or ‘let*’). I definitely do not want to spend too
> much time on this – adding lots of special forms would soon cease to be
> fun, and once (and if!) I have macros, there’s really no use in adding
> them; also, I want to move on to other things.
Once you have macros, implementing the stuff you mentioned should not be
hard if you don't care about efficiency too much.
> So now my question is: does it make sense to play around with it more?
> Would a more complete Elisp interpreter written in Elisp be useful for
> anyone?
For learning purposes, it would be useful.
> If yes, I might consider publishing all my code sooner rather than
> later. And: if it’s interesting and/or useful for anybody, is there
> anything besides lambdas, a proper ‘mci/apply’ function and macros
> that definitely *should* be added? (One thing that comes to mind
> would be special (= dynamic) variables. I’m not sure whether I would
> like to add them – it might be too much work. OTOH, I’d learn to
> implement dynamic binding then...)
If you think you have learned what you wanted to, I would stop. Maybe
you feel like continuing working on it at a later point of time.
But hey, since you asked: Implementing nonlocal exits come to my mind as
a goal. And continuations would be cool. Implementing these are
probably harder lessons.
Regards,
Michael.