per-gron / blackhole

Module system for the Gambit-C Scheme system
MIT License
41 stars 13 forks source link

#!key parameters lack hygiene. #18

Open per-gron opened 14 years ago

per-gron commented 14 years ago

Because of the syntax of DSSSL keyword parameters, they cannot be implemented hygienically. For instance, consider the code

(lambda (#!key a)
  (lambda (#!key a)
    a))

It is impossible to make both versions of a available in the inner scope. This is because you can't rename the keyword parameters because that would change the interface to the function.

The best way that I can think of to fix this is to convince Marc Feeley to implement SRFI 89 in Gambit. That should be possible to do. After all, he wrote that SRFI =)

When SRFI 89 is implemented in Gambit, you'd have to rewrite lambda-helper in hygiene.scm to convert DSSSL keyword parameters to the SRFI 89 format. That shouldn't be very difficult to do.

per-gron commented 14 years ago

Note that this bug really isn't very serious; it can only show up when you have nested functions with keyword parameters, and they have a keyword parameter with the same name, and you actually refer to the outer parameter inside of the inner function. I haven't ever run into this problem.