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

[no subject]



Oh, now I see.  Yes, you're right.  The only question is whether to
bother introducing the name OPENF, since it does look like the new
functinality could be added to OPEN and WITH-OPEN-FILE without changing
the old functionality.

If nobody says anything for a while, I will change OPEN and
WITH-OPEN-FILE to accept the new syntax as well as the old, with the
aim of leaving it that way forever so that we do not have to force the
users to change their code, and so that we don't need new versions of
both of these things.  If anyone disagrees, say so and I will cease and
desist.

I disagree about things "optionally taking arguments".  There are two
reasons to prefer the convention that all keywords should always take
one argument.  One reason is that if you have a keyword whose presence
or absence is serving as a flag, then it is hard to take a boolean
value and pass that on to a function as a flag.  That is, suppose function
FOO has a :BINARY-P keyword argument.  Then
  (foo ':bar 4 ':binary-p x ':baz 5)
is simpler than
  (if x
      (foo ':bar 4 ':binary-p ':baz 5)
      (foo ':bar 4 ':baz 5))
or
  (apply #'foo (append (if x '(:binary-p) nil) '(:bar 4 ':baz 5)))
or anything else I can think of.  The other reason is that keyword
argument lists can be used as disembodied property lists:
  (defun foo (x &rest options)
    (let ((plist (locf options)))
      (if (get plist ':binary-p) ...)))
So I advocate adopting the convention that all keywords always
be followed by an argument.  This does have the problem that
it becomes slightly more verbose to do some things.  For example,
   (open "foo;bar" ':read)
is easier to type than
   (open "foo;bar" ':mode ':read)
or whatever.  I am not sure what to do about this.  Opinions?