On 7/24/12, Alan Manuel Gloria <almkg...@gmail.com> wrote:
> On 7/22/12, Alan Manuel Gloria <almkg...@gmail.com> wrote:
>> Ridiculously big bundle time!!
>>
>> It's the big reorg!!!
>>
>> There are some ridiculous issues with Guile 2.0 and auto
>> compilation.... in particular, autocompilation needs to be ON
>> otherwise replace-read will only work on the REPL, not inside
>> use-modules........... WEIRD.
>
> Okay I've been tracing things on Guile 2.0...
>
> The use-modules syntax expands down to process-use-modules.  This is
> in (ice-9 boot-9)
>
> process-use-modules invokes resolve-interface, which invokes
> resolve-module, which invokes try-load-module, which invokes
> try-module-autoload.  try-module-autoload then invokes down into
> primitive-load-path.
>
> primitive-load-path is predefined in C, in libguile/load.c .  On 2.0,
> it has this complicated set of tests, which boil down to "try to
> compile the code and load it if compilation fails, but only if
> autocompiling is set".  Apparently, this process of compilation will
> invoke our replaced primitive-load.
>
> The *other* branch (the part where it doesn't compile the Scheme code)
> then calls into the C function scm_primitive_load(),  Not the Scheme
> variable primitive-load, the one we took pains to modify.
>
> Sigh.
>
> I could try to duplicate what primitive-load-path does in Scheme, but
> the C code on 2.0 is long, boring, and looks like it uses a few things
> inaccessible in Scheme.
>
> Sigh.
>
> I'll sneak a look at 1.6 and 1.8, but I suspect primitive-load-path
> calls through the primitive-load variable rather than directly calling
> into the C code.

After further analysis work....

Now, initially my idea was to hack into primitive-load on 1.6 and 1.8,
and use the new current-reader fluid on 2.0.  But on 2.0, inexplicably
current-reader would get reset at each use-modules.

It turns out that (language scheme spec) specifically resets
current-reader when constructing a new environment; presumably, this
happens for loading.

Now, in the current implementation of sweet-expressions we also
overwrite the 'read binding.  And it seems that this binding gets used
inside (language scheme spec).  But (language scheme spec)'s reader
appears to be used only for compilation, not interpretation -
primitive-load-path is used for interpretation!

In short: this is a lot of work for little gain (specifically, so that
use-modules will work correctly on Guile 2.0 when autocompilation is
turned OFF).  We can just say that currently, on Guile 2.0,
autocompilation (the default) needs to be enabled in order to work
properly.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to