[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: #f = #none ?
- To: info-dylan@cambridge.apple.com, Stavros Macrakis <macrakis@osf.org>
- Subject: Re: #f = #none ?
- From: alms@cambridge.apple.com (Andrew LM Shalit)
- Date: Wed, 18 Nov 1992 11:16:31 -0500
At 10:57 AM 11/18/92 -0500, Stavros Macrakis wrote:
> Imagine a function which takes an optional argument which is to be
> True, False, or Dont-care. Presumably if the argument is omitted, the
> value should be Dont-care. How will we encode these values? We can't
> use #f for False, because it also means that the argument isn't there.
> We could use #t for true, but we'll have to be careful, because all
> boolean functions in Dylan allow any non-#f value to represent
> True....
>
> So perhaps we'll need to define a new type which takes values
> (singletons) True, False, and #f... Seems silly, and error-prone.
>
> -s
(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
)))