[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
#f = #none ?
- To: email@example.com
- Subject: #f = #none ?
- From: firstname.lastname@example.org (Sam Pilato)
- Date: Thu, 19 Nov 92 14:45:11 EST
- Cc: email@example.com, firstname.lastname@example.org
- In-reply-to: Bob Kerns's message of Thu, 19 Nov 92 13:44:37 -0500
Date: Thu, 19 Nov 92 13:44:37 -0500
From: Bob Kerns <email@example.com>
(values :frob frob-val)
I agree with Fry. I would much prefer being able to:
(foo :frob (if frob-p frob-val <use-the-default-value>)
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)
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.)