Email list hosting service & mailing list manager

Keyword arguments in procedures specified in SRFIs Lassi Kortela (21 Jul 2019 19:42 UTC)
Re: Keyword arguments in procedures specified in SRFIs Arthur A. Gleckler (21 Jul 2019 20:43 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (21 Jul 2019 20:52 UTC)
Re: Keyword arguments in procedures specified in SRFIs Arthur A. Gleckler (21 Jul 2019 20:55 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (21 Jul 2019 21:12 UTC)
Re: Keyword arguments in procedures specified in SRFIs Amirouche Boubekki (21 Jul 2019 21:30 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (21 Jul 2019 21:47 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (21 Jul 2019 22:45 UTC)
(missing)
Re: Keyword arguments in procedures specified in SRFIs Arthur A. Gleckler (22 Jul 2019 01:27 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (22 Jul 2019 05:22 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (22 Jul 2019 09:07 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (22 Jul 2019 09:24 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (21 Jul 2019 22:06 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (21 Jul 2019 21:22 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (21 Jul 2019 21:48 UTC)
Re: Keyword arguments in procedures specified in SRFIs Shiro Kawai (22 Jul 2019 16:54 UTC)
Re: Keyword arguments in procedures specified in SRFIs Peter Bex (22 Jul 2019 18:52 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (22 Jul 2019 19:09 UTC)
Re: Keyword arguments in procedures specified in SRFIs Peter Bex (22 Jul 2019 19:22 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (22 Jul 2019 19:32 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (22 Jul 2019 20:08 UTC)
Re: Keyword arguments in procedures specified in SRFIs Marc Feeley (22 Jul 2019 20:36 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (22 Jul 2019 21:56 UTC)
Re: Keyword arguments in procedures specified in SRFIs Marc Feeley (22 Jul 2019 19:36 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (22 Jul 2019 20:22 UTC)
Re: Keyword arguments in procedures specified in SRFIs Per Bothner (23 Jul 2019 00:22 UTC)
Re: Keyword arguments in procedures specified in SRFIs Peter Bex (23 Jul 2019 05:39 UTC)
Re: Keyword arguments in procedures specified in SRFIs Per Bothner (23 Jul 2019 05:57 UTC)
Re: Keyword arguments in procedures specified in SRFIs Peter Bex (23 Jul 2019 06:02 UTC)
Re: Keyword arguments in procedures specified in SRFIs Shiro Kawai (22 Jul 2019 22:05 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (22 Jul 2019 23:13 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (22 Jul 2019 23:58 UTC)
Re: Keyword arguments in procedures specified in SRFIs Shiro Kawai (23 Jul 2019 03:35 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (24 Jul 2019 12:11 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (24 Jul 2019 12:34 UTC)
Re: Keyword arguments in procedures specified in SRFIs Marc Feeley (24 Jul 2019 13:26 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (24 Jul 2019 13:42 UTC)
Re: Keyword arguments in procedures specified in SRFIs Marc Feeley (24 Jul 2019 14:05 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (24 Jul 2019 15:55 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (24 Jul 2019 13:32 UTC)
Re: Keyword arguments in procedures specified in SRFIs shiro.kawai@xxxxxx (26 Jul 2019 14:20 UTC)
Re: Keyword arguments in procedures specified in SRFIs John Cowan (21 Jul 2019 20:49 UTC)
Re: Keyword arguments in procedures specified in SRFIs Per Bothner (22 Jul 2019 05:44 UTC)
Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela (22 Jul 2019 08:35 UTC)
Re: Keyword arguments in procedures specified in SRFIs Per Bothner (22 Jul 2019 15:52 UTC)

Re: Keyword arguments in procedures specified in SRFIs Lassi Kortela 21 Jul 2019 22:06 UTC

Interesting to hear the opposite point of view from you :) For me,
keyword args are one of the most frequent things I miss.

> I never use keyword argument in Scheme. In Python I use them for documentation
> purpose, but good naming can avoid that problem.

In my experience, it can't. In a big program or complex library there
are going to be a few procedures where it's not possible to plan years
ahead. Emacs has many good examples, for example.

> FWIW, Guile has them in a
> convoluted way (you can reference arguments in other arguments and their are
> bound at call time) and I find it... disturbing. At some point Python
> arguments will
> be Turing Complete for sure.

:D Common Lisp also has a super-convoluted argument syntax when you go
into the details (but like most things in CL, it's very consistent, so
that's nice). I agree that it goes too far.

> FWIW, the worst thing in keyword arguments in Python is the **kwargs which
> is equivalent to Guile #:allow-other-keys.

Common Lisp also has that (it's called &allow-other-keys there too). I
like it - not good for most things, but it can help save the day where
you or someone else messed up the design. That's much of the point of
keyword arguments in general: compensate for innate weaknesses in human
planning ability.

> Yes Guile use #:keyword for keywords
> another thing that is disturbing. People end up abusing **kwargs and pass around
> all the keys and only pick what they want / need when they need it.

Clojure (well, Rich Hickey) actively encourages this kind of mentality.
I think his arguments are consistent and I respect them. Like most good
things, it can be taken too far.

In Python, keyword arguments compensate for the lack of macros a lot. In
a Lisp they probably wouldn't need to be as flexible.

> I think adding keyword, will make procedure signature much more difficult.
>
> The solution to use alist or case-lambda is enough complication.
>
> What I was thinking about this topic, is not introduce another datum
> like :keyword
> or #:keyword but instead create some argument parser procedure like used
> for command line arguments. This is backward compatible and build upon existing
> knowledge.
>
> E.g.
>
> (define (my-procedure . args)
>    (receive (parse-args '--wal? '--in-memory?)
>      (wal? in-memory?) ....)))

I've spent a lot of time thinking about Unix argument parsers, and it's
likely the solution will not be simpler than keyword arguments :)

I personally love the way Common Lisp and Python do them. (But Common
Lisp goes too far with the lambda list syntax. Python may go to far as
well; I haven't followed its development in the last 2-3 years.)

> I don't know what are plist.

plist = property list. The same thing as an alist (association list),
but the association pairs are flattened. For this example alist:

     '((foo . #t) (bar . 2) (baz 3 4))

The equivalent plist is:

     '(foo #t bar 2 baz (3 4))

Hence a plist must always have an even number of items (can be zero).
They are used in Common Lisp and Emacs Lisp quite a lot.