From ... Path: archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.vmunix.org!uio.no!nntp.uio.no!not-for-mail From: Erik Naggum Newsgroups: comp.lang.lisp Subject: Re: plugins and lisp Date: 02 Feb 2004 21:35:12 +0000 Organization: Naggum Software, Oslo, Norway Lines: 28 Message-ID: <2004-033-855-KL2065E@naggum.no> References: <8fb8b19a.0402020408.6afce16d@posting.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: readme.uio.no 1075757712 14135 129.240.65.203 (2 Feb 2004 21:35:12 GMT) X-Complaints-To: abuse@uio.no NNTP-Posting-Date: Mon, 2 Feb 2004 21:35:12 +0000 (UTC) Mail-Copies-To: never User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.lisp:11736 * Pieter | How will a plugin type thing work on lisp? The usual issues, loading binary code and making it possible for it to call already loaded code, are trivial. The loading and linking phases of Common Lisp environments are entirely transparent. However, you need to think about how you wish to «register» your code so that the system can call it. One common way to do this is via hook variables -- lists of functions to call with no arguments and only for effect at known points in the code. Another common way is to use CLOS methods with :BEFORE, :AROUND, and :AFTER qualifiers. You need to plan for either way. Other ways are possible, such as replacing a function entirely, but then it may be difficult to load more than one plugin that does this, even if you store the old definition in some variable and call it at the appropriate time. | In c++ I would make a nice base class with a bunch of pure virtuals. | The .so or .dll will return a pointer to an instance of the base class | and so the story goes. Is the approach in Lisp similar? Generally, no, but you could certainly arrange for something like it. -- Erik Naggum | Oslo, Norway 2004-033 Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.