On Thu, Oct 17, 2019 at 6:16 AM Lassi Kortela <xxxxxx@lassi.io> wrote:

Apart from efficiency concers, classic Common Lisp-style keyword args
are also hard to type-check statically.

Actually they aren't, as long as the keywords are apparent at the point of call.
 
So you start out
with some procedure like "write-json" and after a few months you realize
that options are needed for indentation, newlines, character encoding
and the like.

Of course, you probably should know there are going to be *some* options in advance, and then you go with an alist argument or plist arguments.  Or else you decide that sticking to the RFC is enough, and anything else should be done in a separate prettyprinter.   That's what I plan to do with CSV, where the CSV operations will implement just the RFC (modulo character and newline encoding) and I'll a separate DSV parser/formatter for handling arbitrary delimiters, escaped tabs and newlines, and everything else.  If the options interact in complex ways, a builder procedure may even be the right thing, even though it's inherently imperative.



John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
Said Agatha Christie / To E. Philips Oppenheim
"Who is this Hemingway? / Who is this Proust?
Who is this Vladimir / Whatchamacallum,
This neopostrealist / Rabble?" she groused.
        --George Starbuck, Pith and Vinegar