From: David J. Cooper Jr
Subject: Subject: Flavors Introspection (was: Re: required-x and protocols in  CLOS)
Date: 
Message-ID: <3A2C6369.8B716051@genworks.com>
Tim Bradshaw <···@tfeb.org> writes:
>
> Flavors used to have a feature where you could say when defining a
> flavor that any non-abstract flavor that inherited from this would
> have to inherit from various other things, and possibly would have to
> implement various methods too.  
> 

In the current ACL Flavors system, the following are available as
``Defflavor options:''

 :required-init-keywords 
 :required-instance-variables
 :required-methods
 :required-flavors

These are documented in "flavors.htm" in the doc/ subdirectory of the
Allegro CL distributions.


Speaking of Flavors, does anyone know a clean way to get a list of
instance variable names from a Flavor instance? Currently I am using
the :which-operations message, and resorting to:

 (remove-if #'(lambda(op)
		(or (member op (list :unique-id :eval-inside-yourself
				     :print-self :name :describe
				     :operation-handled-p :which-operations
				     :pseudo-fasd-form :init 
                                     :funcall-inside-yourself
				     :send-if-handles :break :get-handler-for))
		    (string-equal (subseq (string op) 0 3) "set")))
	    (the :which-operations))

Thanks,

 -dave


-- 
David J. Cooper Jr, Chief Engineer	Genworks International
·······@genworks.com                    5777 West Maple, Suite 130
(248) 932-2512 (Genworks HQ/voicemail)	West Bloomfield, MI 48322-2268
(248) 407-0633 (pager)			http://www.genworks.com

From: Steven M. Haflich
Subject: Re: Subject: Flavors Introspection (was: Re: required-x and protocols in  CLOS)
Date: 
Message-ID: <3A2CA441.7FE45F2B@pacbell.net>
"David J. Cooper Jr" wrote:

> Speaking of Flavors, does anyone know a clean way to get a list of
> instance variable names from a Flavor instance? Currently I am using
> the :which-operations message, and resorting to:
> 
>  (remove-if #'(lambda(op)
>                 (or (member op (list :unique-id :eval-inside-yourself
>                                      :print-self :name :describe
>                                      :operation-handled-p :which-operations
>                                      :pseudo-fasd-form :init
>                                      :funcall-inside-yourself
>                                      :send-if-handles :break :get-handler-for))
>                     (string-equal (subseq (string op) 0 3) "set")))
>             (the :which-operations))

I believe there is no "portable" way to do this, the design of the
Flavor system having been insufficiently introspective when it was
designed 20 years ago.  However, the following two idioms will work
reliably in ACL:

(fla::flavor-all-ivs (fla::fl-lookup FLAVOR-NAME))
(fla::flavor-all-ivs (fla::fl-desc INSTANCE))

The first of these will return NIL if the flavor has never been
composed.  The second cannot be executed if the flavor has never
been composed...
From: Kent M Pitman
Subject: Re: Subject: Flavors Introspection (was: Re: required-x and protocols in   CLOS)
Date: 
Message-ID: <sfwg0k3weym.fsf@world.std.com>
"David J. Cooper Jr" <·······@genworks.com> writes:

> Speaking of Flavors, does anyone know a clean way to get a list of
> instance variable names from a Flavor instance?  [...kludge omitted...]

What you're doing will only check for settable instance variables and
isn't very reliable.  I know the low-level stuff is there because it
has to get used if the flavor is redefined or inherited from.  Don't
the sources get distributed with the system?  I'd just poke around
there or use the inspector.