gosh is started in the interactive REPL mode, it loads
~/.gaucherc if it exists. I suppose it may be handy
if the user needs his own local setup, even though I personally
haven't used the rc file yet---I guess it's a sort of traditional
Recently I realized this feature interferes with R7RS mode.
.gaucherc file is loaded into
but what's visible from the user module differs greatly
gosh is invoked with
-r7 option. It'll be
quite difficult to write
.gaucherc that can work
both in traditional Gauche mode and r7rs mode.
(Note: I say r7rs mode and Gauche mode, but it's not that
there are two separate modes, except the planned reader compatibility
modes. You can load R7RS library from
standard Gauche program and load Gauche library from standard
R7RS program, no matter whether you start
option or not. The
-r7 option merely specifies which
environment you're in at the time interactive REPL starts.)
I considered a few options:
-r7option is given, try to load a different rc file, e.g.
~/.gaucherc-r7. This option is less appealing: It scatters more rc files in the home directory. Besides, I expect things you want to do in rc file are likely to need to access Gauche-specific features (e.g.
add-load-path) and you can't do that easily from R7RS environment. You would need to create a separate module, e.g.
mysetup.scmfor the setup code, then
- Let rc file be loaded in a module other than
gauche.usermodule. Then you can use Gauche features in
.gaucherc, regardless of
-r7option. This is clean, but adding a new module just for the rc file seems a bit overkill. Besides, it is incompatible to the current version if a user defines something in
.gauchercand expect it visible from the user module.
.gauchercsupport. This is a tempting solution, for it makes things simpler. But who knows? Sometimes this kind of hook comes handy unexpectedly.
Eventually I settled on somewhat compromised design.
- We load
#<module user>, as we have been doing.
goshis started with
-r7option, the initial module will be
#<module r7rs.user>, not
It looks a bit ad-hoc solution, but let's give a shot.