[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Closures - do you understand them well?
From: |
tomas |
Subject: |
Re: Closures - do you understand them well? |
Date: |
Fri, 23 Dec 2022 07:27:38 +0100 |
On Thu, Dec 22, 2022 at 05:00:25AM +0100, Emanuel Berg wrote:
> tomas wrote:
>
> > Just at macro expansion (aka compile) time
>
> 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).
Cheers
[1] https://en.wikipedia.org/wiki/It%27s_turtles_all_the_way_down
[2] That's why lexical is easier for optimising compilers
--
t
signature.asc
Description: PGP signature
- Re: Closures - do you understand them well?, (continued)
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- Re: Closures - do you understand them well?, tomas, 2022/12/10
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/11
- Re: Closures - do you understand them well?, tomas, 2022/12/12
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/12
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/22
- Re: Closures - do you understand them well?,
tomas <=
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/09
- Re: Closures - do you understand them well?, Tassilo Horn, 2022/12/10
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- Mutation - do you understand it really? (was: Closures - do you understand them well?), Stefan Monnier, 2022/12/10
- Re: Mutation - do you understand it really?, Michael Heerdegen, 2022/12/10
- Re: Closures - do you understand them well?, Michael Heerdegen, 2022/12/10
- Re: Closures - do you understand them well?, Tassilo Horn, 2022/12/11
- Re: Closures - do you understand them well?, Emanuel Berg, 2022/12/10
- RE: [External] : Re: Closures - do you understand them well?, Drew Adams, 2022/12/10