freenode/#sicl - IRC Chatlog
Search
10:50:02
jcowan
Is it clear that rehydrating the AST is quicker than regenerating it from source? Early Ada compilers stored the AST in precisely this way, but gnat does not, because the cost of reading it was found to be higher than the cost of reading *and* reparsing the source.
11:01:50
heisig
The important thing about the SICL AST is that it fulfills the requirements of 'minimal compilation'. Otherwise, one would also have to store a copy of the environment at the time of compilation.
11:07:05
beach
jcowan: The compilers of most languages process source code in a completely empty environment. For example, a C program must include .h files in order to add some definitions to the initial environment.
11:07:05
beach
Not so with Common Lisp. A file is compiled in the "startup environment" which is the state of the global environment of the Common Lisp image when the compiler was invoked. That fact radically changes how things must be done in Common Lisp compared to in other languages.
11:07:47
beach
I intend to formalize this idea at some point, because it is the root cause of why it is harder to bootstrap Common Lisp in Common Lisp than it is to bootstrap C in C for instance.
11:27:50
jackdaniel
jcowan: environment is passed explicitly as an argument (special calling convention is required)
11:29:12
jackdaniel
also for global environment (i.e not lexical) you may have a variable env which is, heh, global
11:34:47
beach
jcowan: Sorry, slow thinker alert here. What requirement are you talking about, and why does that requirement seem to make CL->C systems more difficult?
11:53:48
jcowan
What I find surprising is that macros defined at the REPL must be taken into account by file-compiling done at the same REPL.
11:55:31
jackdaniel
jcowan: you may find this article (if you don't know it yet) very interesting: https://www.dreamsongs.com/Files/Incommensurability.pdf
11:57:43
jackdaniel
many people perceive programs (after initial compilation) as finished entities which manipulate their input (so they are static)
11:58:52
jackdaniel
but image-based applications are very much real, not a theoretical possibility. program may be changed (i.e updated, fixed) without restarting it, it is enough to recompile some entities which are requierd to be changed
12:00:04
jackdaniel
no downtime and debugging of "living" issue are two things which come to mind as direct perks of having such organic environment to work on
12:00:10
jcowan
On reflection, it makes sense, though, given that the compiler is intended to mimic the REPL's behavior.
12:01:27
jackdaniel
I think it is more: "using the same environment" than "mimicing one another", unless I misunderstand you
12:18:08
jcowan
I meant that loading a FASL file is supposed to have the same effects that loading a source file would.
12:20:04
jcowan
I note that this is not entirely true, however. A compiled defstruct with :include, where the included struct is defined at the REPL, does not produce the same results when loaded (at least in sbcl) if the included struct defined at load time differs from that at compile time.
12:21:53
beach
EQ-ness of sometimes lost, so there is a concept of "similarity" to compensate for that loss.
12:23:01
beach
I am reading this page: http://www.lispworks.com/documentation/HyperSpec/Body/03_ba.htm and I am wondering about the consequences of the evaluation environment and the compilation environment being different.
12:23:36
jcowan
I tried to reduce things to a simple case, but they seem even more broken than I thought.
12:23:55
beach
So a subsequent (eval-when (:compile-toplevel) ...) may not be able to use that macro definition. Am I right?
12:24:36
jcowan
into a file, defined (defstruct foo x) at the REPL, and loaded the file. (make-bar) returns a structure with two slots, as expected.
12:26:24
beach
So I really should implement incremental first-class global environments, i.e. where modifications are made in a "delta" so that they do not alter the original environment.
12:27:02
beach
That way, the evaluation environment would be a delta on top of the startup environment and the compilation environment would be a delta on top of the evaluation environment.
12:27:46
jcowan
But if I compile the file, throw away the world, evaluate (defstruct foo x1 x2) and load the FASL, iI get a warning and then (make-bar) is not even defined!
12:28:01
beach
I need these deltas in Second Climacs anyway, because I want to be able to "back out" some modifications to the environment when some top-level form changes.
12:29:37
jcowan
Sorry, there is a load-time error, not just a warning (I missed it in the noise of loading): "The loaded code expects an incompatible layout for class FOO."
12:31:12
heisig
beach: Implementing environment deltas sounds really error-prone. What about implementing purely functional first class global environments? Or is that the idea?
12:32:15
jcowan
The (proposed) global-environment system for Scheme allows both mutation and chaining of environments in the manner of an alist.
12:32:42
jcowan
As things now stand, a Scheme must provide multiple environments, but only one is required to be mutable.
12:33:38
jcowan
I tried the same process with clisp, where loading the FASL file provokes a different error: "The class FOO has no slot named X", although there is no reference to X in the definition of struct bar.
12:34:09
beach
jcowan: For your information, since I have first-class global environments, I also plan to make it possible to start a compilation from a fresh environment, equivalent to the one containing only the standard Common Lisp functionality.
12:34:33
beach
jcowan: If you expect stuff like that to work, I think you are going to be disappointed.
12:36:00
jcowan
I was surprised to see early binding in a basically late-binding language, that's all.
12:36:03
beach
heisig: I was thinking of an environment divided into a small number of layers. A lookup would search the layers in order. A mutation would alter the topmost layer.
12:36:11
heisig
beach: I would assume that implementing deltas would roughly double the amount of special purpose code (first look in the delta, then in the underlying environment), whereas for purely functional environments, it would be sufficient to use the right data structures internally.
12:37:34
jcowan
With the proviso that binding a special variable also must count as mutation for this purpose. Binding *print-pretty* in one environment should not affect all environments.
12:38:08
beach
heisig: I think that's correct. Every query operation would have to do a recursive call if it fails. Though it might be possible to automate the definitions so that this code does not have to be written out explicitly for each query operation.
12:39:01
beach
jcowan: Yes, I am sure there are exceptions to the general rule. I would just have to think about every operation and determine the behavior in the case of layers.
12:40:19
jcowan
Indeed, it is assoc where some of the objects on the alist are hashtables rather than key-value conses.
14:04:27
scymtym
i sometimes use the names LOOKUP, DIRECT-LOOKUP and (SETF DIRECT-LOOKUP) (and maybe (SETF LOOKUP) which just calls (SETF DIRECT-LOOKUP)) when implementing stackable environments. that way, clients can choose which lookup they want
14:06:09
beach
I guess if I systematically make my functions return a second value (T or NIL), most of that stuff could be automatically generated.
14:13:32
jcowan
I think it would be important to not allow mutations+ to affect lower layers. If you need to mutate a lower layer, you need a pointer to it so you can make it the topmost layer.
15:58:46
beach
Hmm. I think I have been depriving myself of the kind of customization that I explicitly designed Cleavir to allow.
15:59:25
beach
In the particular case I am thinking of, I have generated some twisted code in order to get the function cell of a global function.
16:00:23
beach
I have been generating LOAD-TIME-VALUE ASTs with forms like (sicl-genv:find-function-cell '<name> (sicl-genv:global-environment))
16:08:05
beach
There is a lot of stuff going on in my mind right now. I take that as a sign that many pieces of the puzzle are falling into place simultaneously. It is exciting, but also exhausting.
16:10:30
frgo
beach: No hurry. The Human Mars Expedition is still years away, but would clearly benefit from SICL ...
16:11:50
beach
frgo: Yes, yes, I know. I have been working on it (off and on) for a long time so I know there is no rush. What triggered this latest panic was the fear that the ELS paper submission on bootstrapping would not be accepted unless I could show more progress.
16:12:59
frgo
Don't get me wrong: I am also excited on what's happening here with SICL. I really enjoy you and the gang here posting about SICL and related topics.
16:14:18
frgo
I still am looking for a solid, thoroughly thought out solution ... even if it takes longer than submission deadlines or submission qualification ;-
16:15:40
beach
I agree. It's stupid to panic about that. First, it *might* get accepted anyway. Second, I have two more submission in the pipe. Third, it is no disaster if I have no papers at ELS one year.