freenode/#sicl - IRC Chatlog
Search
13:15:04
beach
When I work on this bootstrapping stuff, I sometimes feel like I am discovering elementary programming practices that I either never knew or forgot about. I often find myself having a name of a standard function that needs to have a different definition in each environment, like, say FIND-CLASS.
13:15:15
beach
But then I have some other standard function, say ENSURE-CLASS that needs to call FIND-CLASS, but there is a clash in that the ENSURE-CLASS in one environment needs to call the FIND-CLASS in the preceding environment (this is just an example).
13:15:24
beach
In the past I have struggled with this problem and often came up with twisted solutions like defining FIND-CLASS in its correct environment (say E2), and then moving the definition (which is easy) to the environment in which ENSURE-CLASS is defined (say E3).
13:15:34
beach
But this solution makes it problematic in the next phase where the same trick has to be repeated for E3 and E4.
13:15:42
beach
So my twisted solution in the next phase was to temporarily save the definition of FIND-CLASS in E3 as a temporary name, then define FIND-CLASS in E3, move it to E4, and then restore the original definition if find-class in E3.
13:15:49
beach
But the solution is stupidly simple. Instead of calling FIND-CLASS directly from ENSURE-CLASS I can introduce an indirect function, say FIND-CLASS-FROM-ENSURE-CLASS which is defined in E3 and which calls FIND-CLASS in E2, and defined in E4 to call FIND-CLASS in E3. Problem solved.
13:17:43
beach
The "production" version of FIND-CLASS-FROM-ENSURE-CLASS is of course just a call to FIND-CLASS.
13:18:04
|3b|
ACTION probably would have tried to do some sort of CALL-IN-PREVIOUS-ENVIRONMENT thing :/
13:20:10
beach
I often found myself having a production version that won't work during bootstrapping.
13:21:04
beach
ENSURE-GENERIC-FUNCTION must be defined in some environment, say E2 but it needs to define the biding of the newly created function in say E3.
13:21:29
beach
So I abandoned completely, defining my own (long) version of ENSURE-GENERIC-FUNCTION.
13:22:45
beach
Introduce an indirection, say DEFINE-THE-NAME and have that function define the newly created generic function in a different environment.
13:24:18
beach
This feeling is hard to describe. It's like a child discovering new toys, or a carpenter discovering the use of some previously-unused tools in the tool box.
13:29:45
beach
But I am determined to go through this bootstrapping code with a fine-tooth comb to make sure I catch any silliness on my part, and to make the code as understandable as I possibly can.
13:30:18
beach
I don't want to be the only person in the world being able to understand it. And in fact, there are parts of it that even I don't understand at the moment.