Article View: comp.lang.clos
Article #187Re: Type declarations Re: Generic Macro Proposal
From: Graham Matthews
Date: Wed, 26 Aug 1992 04:09
Date: Wed, 26 Aug 1992 04:09
45 lines
2267 bytes
2267 bytes
john@linus.mitre.org writes: >Joe Konstan writes: > First, it seems important to have declarations that declare an exact > type instead of just a general type. Thus, > (DECLARE (EXACT-TYPE CLASS-1 OBJECT)) > should indicate that object is treated as an instance of class-1, > and not as an instance of a subclass. >and Graham Matthews (graham%maths.su.oz.au@uunet.uu.net) replies: > Why not take this the whole hog and treat your object heirarchy as > an ordered set (which it is in the single inheritance model - not > sure about multiple inheritance) and allow the programmer to write a > type spec like > FUNCTION F( <= TYPE_A, > TYPE_B ) > etc >A type hierarchy with single inheritance is NOT an ordered set, it's >only partially ordered. I was thinking of one branch of the tree here. In general it is indeed partially ordered. >Still, such declarations might be useful, and >you can already make them in Common Lisp: > (DEFUN FOO (X) > (DECLARE (TYPE (AND SYMBOL (NOT NULL)) X) > ...)) >This declares that the type of X is "exactly" SYMBOL. This is not what I proposed. This allows on = on the order, and I am suggesting to extend this to <, etc >However, the >declarer must know the exact nature of the hierarchy, whereas Joe >Konstan's EXACT-TYPE declaration doesn't require that every >subclass/subtype be enumerated in the declaration. No this is not true. To use a type spec like, "t1<t2" one needs only know that all types/classes less than t1 satisfy some condition. In algebraic programming this is often the case, with group < ring < field... graham -- Graham Matthews And it's true we are immune Pure Math, Uni.Sydney, Oz When fact is fiction and T.V. is reality graham@maths.su.oz.au
Technical Details
Message-ID:
<graham.714802169@galois>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!grahamReferences:
<9208251442.AA02269@thelonius.mitre.org>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!graham From: graham@maths.su.oz.au (Graham Matthews) Subject: Re: Type declarations Re: Generic Macro Proposal Message-ID: <graham.714802169@galois> Sender: graham@maths.su.oz.au Nntp-Posting-Host: galois.maths.su.oz.au Organization: School of Mathematics and Statistics, University of Sydney References: <9208251442.AA02269@thelonius.mitre.org> Date: Wed, 26 Aug 1992 04:09:29 GMT Lines: 45