[gambit-list] Can #. or equivalent be made available when compiling files?

Marc Feeley feeley at iro.umontreal.ca
Mon Aug 29 10:15:22 EDT 2011


Here's a solution to enable the #.XXX syntax from the command line.

Marc

% cat test.scm
(display #.(string-append "hello"
                          " world"
                          "\n"))
% gsc -expansion -exe -e '(current-readtable (readtable-eval-allowed?-set (current-readtable) #t))' test.scm
Expansion:

(display "hello world\n")

% ./test
hello world


On 2011-08-29, at 5:13 AM, Mikael wrote:

> Hi Matt - this is where getting into Gambit's sourcecode comes into the picture:
> 
> Look up load/compile-file there and trace your way down the sourcecode to the read/read-all call, this will show you which port is used. And, check if there's any callback or inheritance you can use for altering the readtable, or implement a callback yourself and recompile.
> 
> Mikael
> 
> 2011/8/28 Matt Lamari <matt.lamari at gmail.com>
> 
> I'm using the compiler by running the gsc executable.
> 
> Where do I inject the code, and for what port?
> 
> I tried using (current-input-port), and executing the readtable-set! from an expanding macro using (current-input-port), that's all I can think of; but it doesn't apply #. .
> 
> Does somebody have this working?  What is the port for the compiler's input stream when running gsc?  And how/where/when should I execute this code to modify the readtable before the .scm file(s) are run?
> 
> Thanks,
> Matt
> 
> 
> 
> 
> 
> On 8/27/2011 7:42 AM, Mikael wrote:
>> Hi Matt,
>> 
>> For sure you can do this, just track down the port that is (read) from on load and compile-file and perform the setting on it. Maybe you could even make a parameterized global variable config-sourcecode-port procedure so you can configure this as you go - and btw maybe that's already in there.
>> 
>> Did you say you want #. switched on for all or parts of your scm file? The earlier ought be more straightforward to implement.
>> 
>> Let the ML know what you got to.
>> 
>> Brgds,
>> Mikael
>> 
>> 2011/8/27 Matt Lamari <matt.lamari at gmail.com>
>> 
>> I want to know if #.  or something equivalent is available when
>> compiling .scm files.  That is, the ability to tell the reader to
>> directly eval a form at read time.
>> 
>> I've been shown this:
>> 
>> http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php?title=Documentation:Procedure_readtable-eval-allowed?-set
>> 
>> But am not sure how this should be applied to reading compiled code, if
>> it's applicable, if it's possible.
>> 
>> If this code or something like it should be used to influence the
>> reader, where should it go?
>> 
>> What's the best way to get the ability to have #. in the middle of
>> compiled .scm?
>> 
>> 
>> Thanks,
>> Matt
>> 
>> 
>> _______________________________________________
>> Gambit-list mailing list
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>> 
>> 
>> 
>> _______________________________________________
>> Gambit-list mailing list
>> 
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
> 
> 
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list