[racket] Simplifying keyword arguments

From: Greg Hendershott (greghendershott at gmail.com)
Date: Wed Jul 21 21:55:36 EDT 2010

I've had the same thought.

Plus with contracts, can even be 3 times in proximity, e.g.

(define/contract (my-pony #:color [color "red"])
   (() (#:color string?) . ->* . any)

which is a bit like the Department of Redundancy Department's Division
of Redundancy Division. :)

Not a very big annoyance for me, but yes I've had similar observation.

On Wed, Jul 21, 2010 at 11:32 AM, Laurent <laurent.orseau at gmail.com> wrote:
> Hi,
>
> When using keyword arguments, I often write:
> (define (foo #:some-arg some-arg) .... )
> or:
> (define (foo #:some-arg [some-arg a-value]) .... )
>
> This redundancy between the keyword name and the argument name bothers me a
> little each time I use it.
>
> Would it be wrong to simplify this to:
> (define (foo #:some-arg)
>   ....
>   (list some-arg)
> )
> and
> (define (foo [#:some-arg a-value])
>   ....
>   (list some-arg)
>   )
>
> where the `some-arg' definitions are automatically made out of the keyword
> name?
> Or maybe I'm just missing the point here. If so please enlighten me.
>
> Thanks,
> Laurent
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.