[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LAMBDA expression to the SATISFIES type specifier
Date: Wed, 11 Sep 85 16:23 EDT
From: Mike McMahon <MMcM@SCRC-STONY-BROOK.ARPA>
Page 43 specifies that the predicate name must be a symbol because of
scoping problems.
First off, I don't see any reason to disallow lexical closures:
(deftype foo (x)
`(satisfies ,#'(lambda (y) (eq x y))))
As for LAMBDA expressions, I would think that the same scoping rules
would apply as for DEFMACRO. That is,
(deftype foo (x)
'(satisfies (lambda (y) (eq x y))))
should not be expected to work any more than
(defmacro foo (x y)
`((lambda (z) (eq x z)) ,y))
In summary, I believe that anything FUNCTIONP is valid as the predicate
in SATISFIES. Is there some more subtle scoping problem that I have
overlooked?
The case I was worried about was
(defun foo (x y)
(declare (type (satisfies (lambda (q) (eq q y))) x))
...)
That's sensible enough, I suppose, but I was leery of the extra
complexity required in a compiler to deal with this (you have to
make closures over type specifiers before handing them off to
SUBTYPEP, etc.).
--Guy