From: SourceForge.net <no...@so...> - 2006-11-06 23:30:57
|
Bugs item #1591671, was opened at 2006-11-06 16:59 Message generated for change (Comment added) made by sds You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=1591671&group_id=1355 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: clisp Group: ANSI compliance issue Status: Open Resolution: None Priority: 5 Private: No Submitted By: Pascal Costanza (pcostanza) Assigned to: Bruno Haible (haible) Summary: typep and subtypep fail on forward-referenced-class Initial Comment: Assume the following definition: (defclass test (forward) ()) Assume further that 'forward is not defined as a class yet, so it is a forward referenced class. In this case, the following forms fail in clisp: (typep 5 'forward) (subtypep 'forward 'standard-object) This doesn't comply with Section 4.3.7 Integrating Types and Classes in the HyperSpec which specifies the semantics of typep and subtypep without restricting them to any metaclasses. The CLOS MOP specifies forward referenced classes to be instances of the metaclass 'forward- referenced-class, so typep and subtypep should support such forward referenced classes. ---------------------------------------------------------------------- >Comment By: Sam Steingold (sds) Date: 2006-11-06 18:30 Message: Logged In: YES user_id=5735 how is (subtypep 'forward 'number) different from (subtypep '(and pathname string) 'number)? if the implementation can prove that a type is empty (at a given time), it can treat it as an equivalent to nil. >Furthermore, the subtyping relationships between classes can >already vary over time in CLOS due to class redefinition. indeed, and when forward is actually defined, the value of (subtypep 'forward 'number) will change. ---------------------------------------------------------------------- Comment By: Pascal Costanza (pcostanza) Date: 2006-11-06 18:06 Message: Logged In: YES user_id=1381112 What set theory interpretation? Your reasoning would imply that any class of which there are no instances at some point in time would be a subtype of number at that point in time. This makes even less sense. The subtyping relationships between classes, structures and conditions are nominal - see http://en.wikipedia.org/ wiki/Nominative_type_system Furthermore, the subtyping relationships between classes can already vary over time in CLOS due to class redefinition. So there can indeed be instances of an instance of forward-referenced-class, after it has been changed to a different metaclass (which doesn't change its identity). ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2006-11-06 17:52 Message: Logged In: YES user_id=5735 Suppose you think it is useful to interpret forward-referenced-class as a type specification, e.g., to enable on to use SUBTYPEP on not-yet defined classes that still carry subclass info. Since such a class has no instances, it is functionally equivalent to type NIL. One implication is, of course, that (subtype 'forward 'number) will return True (an empty set is a subset of any set), thus defeating any usefulness of subtypep for such classes. Anything else will break the set theory interpretation of TYPEP/SUBTYPEP predicates. Since SUBCLASSP is not exported, it is a pity that there is no alternative route available, but I don't think that forward-referenced-class is a good reason to kill the set theory interpretation of the TYPEP/SUBTYPEP predicates. ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2006-11-06 17:28 Message: Logged In: YES user_id=5735 the only sensible interpretation as a type of a forward-referenced-class is NIL (i.e., the empty type) since there can be never any objects of this type. how useful is that?! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=1591671&group_id=1355 |