barmar@think.com (Barry Margolin) (04/12/91)
As those of you who read other comp.lang.lisp or various Lisp-related mailing lists know, I'm compiling a frequently-asked question list for Lisp. I'm in the process of trying to write an answer to the question "how can I access structure slots given the slot name as a parameter?" One possible answer seems to be to use SLOT-VALUE, but I'm not sure how portable this is. I can't find any place in X3J13/88-002R or CLtL2 that specifically says that this is allowed. X3J13/88-003 (the original Meta-Object Protocol draft) defines SLOT-VALUE-USING-CLASS on STRUCTURE-CLASS, so a CLOS implementation that conforms to that should allow it. I tried the two CLOS implementations I have access to; Genera 8.0 supports SLOT-VALUE on structures, but Lucid 4.0 doesn't. So I certainly can't answer that all CLOS implementation provide this capability. However, if the forthcoming MOP spec includes this requirement, I'd like to include it as a possibility in the FAQ answer. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar
Gregor@parc.xerox.com (Gregor Kiczales) (04/15/91)
From: Gregor Kiczales <Gregor@parc.xerox.com> Fake-Sender: gregor@parc.xerox.com To: barmar@think.com (Barry Margolin) In-Reply-To: barmar@think.com's message of 11 Apr 91 22:30:22 GMT Subject: Can SLOT-VALUE be used on structures? Line-Fold: NO Date: Mon, 15 Apr 1991 09:37:22 -0700 From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.clos Date: 11 Apr 91 22:30:22 GMT Organization: Thinking Machines Corporation, Cambridge MA, USA However, if the forthcoming MOP spec includes this requirement, I'd like to include it as a possibility in the FAQ answer. The MOP spec does not require SLOT-VALUE to work on structures. This requirement was dropped in the final version because some people were concerned that it interfered with efficient structure implementations. The terminology in the MOP spec makes it a simple matter for an implementation to document that SLOT-VALUE does work on structures---it need only document the existence of methods on SLOT-VALUE-USING-CLASS et. al.