From: Slava Akhmechet
Subject: Expanding derived type specifiers
Date: 
Message-ID: <87tzv9s85y.fsf@gmail.com>
Hi,

I want to expand a derived type specifier. According to the hyperspec,
there is no standard API to do that:

http://www.lisp.org/HyperSpec/Body/glo_t.html#type_expand

I also found the following post that lists ways of doing it in
different implementations:

http://groups.google.com/group/comp.lang.clos/browse_thread/thread/8bbefff36632f57e/401109b71ef2e15c

I'm wondering if there is a library that abstracts this functionality
for multiple popular implementations, but I can't seem to find
anything on Google. Perhaps someone knows about one?

Also, is it common to encode information into type specs? I'm
considering using type specs of object slots to include "annotations",
but lack of standard expansion API suggests that it isn't a common
practice in Lisp. If this is the case, what are good other ways to
provide annotations for CLOS slots?

-- 
Regards,
Slava Akhmechet.
From: Duane Rettig
Subject: Re: Expanding derived type specifiers
Date: 
Message-ID: <o0slatc6nb.fsf@gemini.franz.com>
Slava Akhmechet <·········@gmail.com> writes:

> Hi,
>
> I want to expand a derived type specifier. According to the hyperspec,
> there is no standard API to do that:
>
> http://www.lisp.org/HyperSpec/Body/glo_t.html#type_expand
>
> I also found the following post that lists ways of doing it in
> different implementations:
>
> http://groups.google.com/group/comp.lang.clos/browse_thread/thread/8bbefff36632f57e/401109b71ef2e15c

The exported way to do it in Allegro CL (since verson 7.0) is by using
excl:normalize-type.

> I'm wondering if there is a library that abstracts this functionality
> for multiple popular implementations, but I can't seem to find
> anything on Google. Perhaps someone knows about one?

Seems like it would be a simple thing to put the definitions you found
in that post and the information here, plus any others, to create a
simple function that does the job.

> Also, is it common to encode information into type specs? I'm
> considering using type specs of object slots to include "annotations",
> but lack of standard expansion API suggests that it isn't a common
> practice in Lisp. If this is the case, what are good other ways to
> provide annotations for CLOS slots?

It sounds from what you are describing that you want to encode type
information into objects, not encode information into type specs.
One possible way to annotate objects or variables with particular
types is with environments; see

http://www.lispwire.com/entry-proganal-envaccess-des

for one library that can be used.

-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182