Path: utzoo!attcan!uunet!wuarchive!julius.cs.uiuc.edu!apple!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!unido!itwdo!asterix!stefan From: stefan@asterix.fhg.de (Stefan Bernemann 7549-139) Newsgroups: comp.lang.lisp Subject: Re: Question about INTERN Message-ID: <1991Jan31.104246@asterix.fhg.de> Date: 31 Jan 91 09:42:46 GMT References: <1991Jan29.055536.1523@magnus.ircc.ohio-state.edu> <5783@idunno.Princeton.EDU> <4037@skye.ed.ac.uk> <1991Jan30.225106.26561@Think.COM> Sender: root@iml.fhg.de Reply-To: stefan@asterix.fhg.de (Stefan Bernemann 7549-139) Organization: FhG-IML D4600 Dortmund Lines: 27 In article <1991Jan30.225106.26561@Think.COM>, barmar@think.com (Barry Margolin) writes: |> [...] |> general, EVAL should only be used as a last resort); |> [...] |> With all this in mind, here's a suggested rewrite of your functions: |> |> (defun get-slot-value (obj slot) |> "Return the value of the specified slot in obj. |> Assumes it is a structure whose accessors use the default naming scheme." |> (when (symbolp obj) |> (setq obj (symbol-value obj))) |> (eval `(,(intern (format nil "~a-~a" (type-of obj) slot)) |> ',obj))) What's the use of eval here? Why don't you use (apply (intern (slot-accessor-fn-namestring obj slot)) obj nil) or something similar? Stefan -- Mail: Stefan Bernemann ! Phone: +49-231-7549233 c/o FhG IML Dortmund ! Fax: +49-231-7549211 Emil-Figge-Str. 75 ! Email: berni@iml.fhg.de D-4600 Dortmund 50, FRG ! ...!{uunet|mcavx}!unido!itwdo!berni