Dear Robert,
On Sun, Jun 1, 2014 at 6:25 PM, Robert P. Goldman rpgoldman@sift.info wrote:
I haven't fully grokked the code changes in the syntax-control branch yet. However, I have read over the design notes in TODO, and pulled them out into a separate file, which I am attaching here. I have annotated with a number of open questions, and added a bullet point to document rationale, which is currently mostly a place-holder for a statement.
OK, I have updated said document with FRR: replies to your RPG: questions.
WRT my concerns about the syntax-control modifications:
I have done some rooting around and have found a few libraries that are intended to set up a system for interactive use with a special readtable. These are things like expert system shells, etc.
So at some point near the end of their system load, they will set *READTABLE* prior to finishing the load and dropping out for the user to deal with them.
I can see that someone might not like this -- indeed, I'd rather there was a (START-FOO-SHELL) command instead. On the other hand, note that these are not really LIBRARIES; these are SYSTEMS. These are not intended to be slurped into something else: the programmer expects that his/her system will load, set up things for an interactive user, and then hand back control to the user through the REPL.
Isn't the syntax control approach fundamentally incompatible with this?
My point is precisely that the *LACK OF* syntax control approach is fundamentally incompatible with this.
If in such an expert system, you directly or indirectly call ASDF or compile without ASDF (e.g. using SLIME), then your custom readtable with confuse the compilation and seriously screw up both your current image and your fasl cache — unless you use an ASDF with the syntax-control feature (and SLIME also uses it, possibly via ASDF).
I don't think this is an especially tasty thing to do, but I'm also not convinced that it's ASDF's job to break arbitrary CL anti-patterns. Changing this behavior is likely to give very confusing bugs that won't be obvious to the poor user.
In this case, we'd be enabling this behavior, which isn't an antipattern, but the entire point of readtables. Even without an expert system, I *want* to be able to safely use e.g. fare-quasiquote at the REPL, if only because I debug systems that use it internally and so want it enabled while I interactively explore them.
On the other hand, I see files where there's something that sets the READTABLE obviously where what's intended is to simply set the readtable for the compiling and loading of this one file, and leaking that change is wrong.
If it's setting the variable, the CLHS mandate on LOAD and COMPILE-FILE to bind *READTABLE* prevent any leak here though there may still be leak at fasl loading time if the effect is not in a (eval-when (:compile-toplevel :execute) ...) and you're either using a concatenated fasl, or your implementation non-conformantly fails to bind *READTABLE* around loading a fasl (vs a source file).
Note that a programmer who wants to be clean about this, in the current world, can set the readtable at the top of a file, and restore it at the bottom. If we take away the current behavior, the programmer who wants to set things up for the user is just completely out of luck. Or, maybe not: the very sophisticated ASDF user could add a PERFORM method on LOAD-OP on the interactive system. I think. I haven't grokked what's going on in syntax-control well enough.
In the syntax-control branch, such a crazy perform method would be ineffective. In the current master branch, it would work, but frankly be crazy.
I am in a quandary about this. IMO the problem is a hole in the CL spec, which doesn't provide a good way to distinguish between two different intended uses for readtables.
Well at least the spec mandates LOAD and COMPILE-FILE to bind *READTABLE* so it does intend a certain level of syntax-control. I suppose enough early lispers must have been bitten by that for the spec to mandate this.
Before merging the syntax-control mods, I need to be convinced that it's appropriate for the ASDF community to force a solution to this problem on the CL community, instead of leaving the CL community to pick its way through the issue as it has to date.
I believe it's the right thing to do. It shouldn't break any program, except maybe real crazy ones that probably don't exist in the wild. And it makes it safe to bind *READTABLE* at your REPL, which is something that is definitely intended by the CLHS and expected by the CL community.
It's one small corner case that wasn't important when ASDF used to be full of holes but that is necessary for it to be complete now that it has matured.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org "Reality is that which, when you stop believing in it, doesn't go away". — Philip K. Dick