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

Re: #f = #none ?



Perhaps we should simply use signals to denote when no keyword has been passed?
This is consistant with the rest of Dylan's treatment of 'undefined' values,
slots, etc.  It should be an error to access them, and that error should be
catchable by a defined handler?

Of course, we could also define a proper bottom to avoid the following
nonsense:

From: alms@cambridge.apple.com (Andrew LM Shalit)
/// At 11:10 AM 11/18/92 -0500, Stavros Macrakis wrote:
/// >    (bind ((no-value (cons #f #f)))
/// >      (define-method true-false-dontcare (#key (arg no-value))
/// >        (select arg id?
/// >          ((#t) "sharp-t was passed")
/// >          ((#f) "sharp-f wass passed")
/// >          ((no-value) "no argument was passed")
/// >          ;otherwise error
/// >          )))
/// >
/// > Small problem here: there is no way to explicitly specify a don't care
/// > value.  Correction: make no-value visible....  Do you like that
/// > solution?  I don't.
/// 
/// I don't see how you can have it both ways.  Either the don't care value
/// is an explicit published part of the protocol, or it's not.

I think Mr. Macrakis means that the "don't care" behavior should occur when
no key value is supplied in the function call.  To make the problem plainer:
Let's say I have a keyword argument that I expect booleans on; under the
current specification of Dylan, I have no way of telling whether the function
was called with key: #f or without a key value.

Now if I could set a handler for <unbound-atom> and try to read 'arg,' this
would solve the problem.  Perhaps a special predicate, like argument-supplied?
or maybe the same predicate could be merged with slot-initialized? ?  Of
course, I think this would be simplest if a true bottom value (like #none)
was introduced to the language.  Having to set a handler here would probably
be over-kill.

Of course, as usual, I will state my opinion that if #none is supplied, it
should not be considered an <object>.

	-- Scot