Re: [Scheme-reports] Draft 3 Comments: Chapter 4
John Cowan 27 Jul 2011 19:38 UTC
Denis Washington scripsit:
> This is a nice trick indeed, but does suffer from some subtle
> complications. Consider the usage example on KeywordArgumentsArcfide:
>
> (define/optional (blah a b c (x: 0) (y: 7))
> (list a b c x: y:))
>
> What if you don't want to call "list", but another procedure which
> itself accepts "x:" and "y:" keyword arguments?
Good point. This is a consequence of a basic Scheme limitation: once
a binding has been shadowed by a more local binding, there is no way
to retrieve the outer binding. A better approach for define/optional
might be to have it take triples rather than doubles: a local variable,
a keyword (always globally bound), and a default value.
--
May the hair on your toes never fall out! John Cowan
--Thorin Oakenshield (to Bilbo) cowan@ccil.org
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports