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

#f = #none ?

   Date: Thu, 19 Nov 92 13:44:37 -0500
   From: Bob Kerns <rwk@crl.dec.com>
   X-Mts: smtp

   (multiple-value-call #'foo
     (if frob-p
     (values :frob frob-val)
     :blech bletch-val)

I agree with Fry.  I would much prefer being able to:

(foo :frob  (if frob-p frob-val <use-the-default-value>)
     :blech bletch-val)

   I wasn't disagreeing with Fry.  But I would not like there
   to be some distinguished value which could not be passed
   in, because it would be interpreted as "use the default value".
   What if you remodularize your code, so that the appropriate
   place to do the defaulting is not in that function, but instead
   in a function three levels of call down?

   The multiple-value-call construct has the correct semantics.
   The syntax is awkward.  However, you can package it up in

   (defaulting foo :frob (if frob-p frob-val :use-default)
		   :blech bletch-val).

I'd still rather use a built-in #none =/= #f, than use a defaulting
macro.  That #none can be passed down those three levels where, in the
defaulting function, Dylan resolves it to the specified default.

Notice that if one hard-codes arguments like ":frob #none", say to
make it clear to the programmer that they have chosen not to override
a default, then Dylan may leave that part out of the call if it likes.
(Of course, Dylan could instead supply #none for all such missing
arguments if it knows the number of legal keywords for a function and
prefers to work with fixed-arity functions.)