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