<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 1:25 PM, <span dir="ltr"><<a href="mailto:bil@ccrma.stanford.edu" target="_blank">bil@ccrma.stanford.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">load has a second argument, the environment to load into,<br>
which defaults to the root environment, so<br>
<br>
(let ()<br>
(load "file.scm" (curlet))<br>
<br>
will place the top-level defines in file.scm into<br>
the local environment. Similarly eval has an<br>
environment argument.<br>
<br></blockquote><div><br></div><div>Excellent!</div><div> </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think that s7 currently doesn't warn about shadowing or<br>
redefining built-in names, though it does complain about<br>
(set! if 3) and the like. lint.scm is equally<br>
lackadaisical. I'll add optional checks in both places.<br>
<br>
It's surprisingly common in current scheme practice<br>
to use (say) 'list or 'string as a variable name --<br>
I wonder if this is actually a common-lisp trope<br>
that schemers are careless about? It does lead to<br>
errors.<br>
<br></blockquote><div><br></div><div>Shadowing a variable can be practical though.</div><div>What I'm especially worried about is writing two different functions</div><div>with the same name doing different things loaded from</div><div>two different files. Especially if loading 3rd party</div><div>scheme files. I did look quickly at s7.c if I could</div><div>add a hook, but I gave up quickly. If it's not much</div><div>work it would be great to be able to add a hook</div><div>which is called every time a global symbol is redefined.</div><div>Then I could show a warning window if the hook is called</div><div>during the first time a scheme file is loaded.</div><div><br></div></div></div></div>