[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative formulations of keywords

This page is part of the web mail archives of SRFI 88 from before July 7th, 2015. The new archives for SRFI 88 contain all messages, not just those from before July 7th, 2015.

On Apr 12, John Cowan wrote:
> Marc Feeley scripsit:
> > For example can your proposed approach work in this case:
> > 
> >    (define (f g)
> >      (g foo: 11 bar: 22))
> Plainly no.  The compiler should cough with "keywords in call of unknown
> function".
> > or in this case:
> > 
> >    (define (f #!key (x 11) (y 22)) (+ x y))
> >    (define (g z) (f y: z))
> >    (define (h) (set! f (lambda (#!key (y 33) (z 44)) (* y z))))
> Again, plainly no.  [...]
> In short, the definition of a function must be either global or
> lexically apparent for it to be callable with keywords.

And there goes all hope of using higher order functions with keywords,
if theses restrictions are used.  (My guess is that you really want
ocaml keyword arguments, which are something completely different than
most use of keywords in the Lisp/Scheme world.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!