[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #f = #none ?
- To: samp@kurz-ai.com (Sam Pilato)
- Subject: Re: #f = #none ?
- From: cfry@MIT.EDU (Christopher Fry)
- Date: Fri, 20 Nov 92 19:52:33 EST
- Cc: rwk@crl.dec.com, cfry@MIT.EDU, info-dylan@cambridge.apple.com
> Date: Thu, 19 Nov 92 14:45:11 EST
> From: samp@kurz-ai.com (Sam Pilato)
> To: rwk@crl.dec.com
> Cc: cfry@MIT.EDU, info-dylan@cambridge.apple.com
> In-Reply-To: Bob Kerns's message of Thu, 19 Nov 92 13:44:37 -0500
> Subject: #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)
> (values))
> :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)
Some very intersting discussions after this caused me to think of yet
another way out of the problem here. I'm not claiming the
below is great, just some more food for thought.
If our problem is getting to explcitly use a default value,
how about a function that, given the name of a function and the name of
one of its arguments, returns the value of the default for that
function. SO:
(defun foo (a &optional (b (+ 2 3)) ...)
(foo 1 (get-default-value 'foo 'b))
One problem is that if we've got
(defun foo (a &optional (b (+ a 3)) ...)
then it doesn't work so well without special hacks.
I guess dylan doesn't have this particular problem but ...
We can all imagine how we could hack the interpreter to
avoid us having to specify ANY args to get-default-value.
But the above soluation is just an add-on, provided its easy
to write it in the environoment.
For the sake of other programming tools, I'd hope it
would be easy to write.