[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Closures - do you understand them well?
From: |
Emanuel Berg |
Subject: |
Re: Closures - do you understand them well? |
Date: |
Wed, 18 Jan 2023 13:23:26 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
tomas wrote:
>> Side question, how many 'times' are there and what, at
>> least conceptually, happens in each? Figure or ascii
>> diagram, anyone?
>
> It's turtles [1] all the way down! Since you have eval, you
> are empowered to compile at run time and thus have a compile
> time in there. Still, there are (at least) two phases (at
> least whenever you have anything more than "just" a naive
> interpreter), one where your "source" is being analysed to
> find opportunities ("this variable is always bound to 3 here
> [2] (or to the identity fun, or...) so we can roll that
> constant into the compile product"), and the run time, where
> that product is "run".
>
>>> Welcome to Lisp's multiple personality :-)
>>
>> Explain :-) :-(
>
> Other languages (e.g. C) have clearly distinct sub-languages
> to do things at compile time (C, again, has CPP, which is
> clearly distinct from C proper). In Lisp, you can use Lisp
> at compile time (the language you use to transform your
> source is Lisp), but at the same time, your environment is
> completely different at those two phases. Some go as far as
> to say that they are different languages. Typically there
> are devices to control that (in Emacs Lisp
> `eval-when-compile' and `eval-and-compile', I'll let more
> knowledgeable folks chime in and complete that list).
The byte-compiler is written in Elisp and it transforms Elisp
including performing various optimization efforts know to the
world of compilers, then the resulting transformed/optimized
Elisp is or can be run independently.
The environment are different since first it's the environment
of the byte-compiler, after that it's the environment of the
compiled program ...
--
underground experts united
https://dataswamp.org/~incal