Newsgroups: comp.lang.lisp.franz,comp.lang.lisp,comp.lang.clos
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.ecn.bgu.edu!vixen.cso.uiuc.edu!uchinews!gw2.att.com!nntpa!ssbunews!iexist!not-for-mail
From: clarisse@iexist.flw.att.com (55437-olivier clarisse(haim)463)
Subject: Re: How to ensure that a method is compiled?
Message-ID: <D954J4.71r@ssbunews.ih.att.com>
Originator: clarisse@tenet
Sender: clarisse@iexist (55437-olivier clarisse(haim)463)
Nntp-Posting-Host: tenet.flw.att.com
Organization: AT&T
References:  <ethan+-2305951205500001@peaceful.cs.pitt.edu>
Distribution: inet
Date: Thu, 25 May 1995 15:33:04 GMT
Lines: 39
Xref: glinda.oz.cs.cmu.edu comp.lang.lisp.franz:463 comp.lang.lisp:17901 comp.lang.clos:3035


Using your example, the following is a bit cleaner as it does
not require you to bind the method to a generated symbol. Also
the method is compiled upon definition, not artificially after
an interpreted definition was first created:

1> (funcall (compile nil `(lambda () (defmethod grok ((foo foo))
					(setf (slot-value foo 'a) 'grokked)))))
#<STANDARD-METHOD GROK (FOO)>

2> (setf grok-method 
         (find-method #'grok '() (list (find-class 'foo))))
#<STANDARD-METHOD GROK (FOO)>

3> (clos:method-function grok-method)
#<Function (METHOD GROK (FOO)) @ #x2684db2>  ;Compiled definition

Note that both ACLPC and MCL have replaced the interpreter
by a compiler so this is done by default on PC and MAC platforms:
any method your code dynamically generates (i.e. to patch itself)
is always compiled by default.

Can you list several advantages of having methods generated by some code
compiled within the application itself (as above) and not after you
first save the generated code to file, compile the file and
then load it (the traditional way it seems)?

Could it be that (CLOS) methods are first class entities
and can therefore not only describe themselves but also compile
themselves without requiring external tools to butcher them?

Might it be possible to cleanly build self improving and adaptive
autonomous software machines based on this property? Could this
be a good ground for research on computational reflection?
-- 
----------------
Olivier Clarisse
Member of Technicall Staff
AT&T Bell Laboratories
