🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #30

Re: Optimizer--or my misunderstanding?

#30
From: kanderso
Date: Mon, 10 Aug 1992 10:38
48 lines
2490 bytes
  To: comp.lang.clos@cis.ohio-state.edu
  Date: 9 Aug 1992 01:37:35 GMT
  Organization: Picasso Research Group, UCB Computer Science Division
  From: Joe Konstan <konstan@elmer-fudd.cs.berkeley.edu>
  Sender: commonloops-request@cis.ohio-state.edu
  Subject: Optimizer--or my misunderstanding?
  
  When trying to compile (with full optimizations, using Lucid 4.0.1) the
  following:
  
  	(defclass foo () 
            ((a-slot :type #+lucid system:procedure :initarg :a :accessor a)))
          (defmethod doit ((self foo))
            (funcall (a self) 3))
  
  The compiler seems unable to optimize the method and gives this message:
  
       ;;;   FAILED TO OPTIMIZE the form:   (funcall (a self) 3)
       ;;;   Possible further declarations:
       ;;;     For arg (a self):  system:procedure
       ;;;                        compiled-function
  
  Is this a mistake in the lucid compiler, or is this a result of my own 
  misunderstanding about the :type declaration in a defclass slot definition.
  
  My understanding, from CLtL2, pg. 779, was that any subclass of foo that 
  redefined the type of slot a-slot would automatically be defining it
  as (and system:procedure ...).  Does this type restriction not apply to
  the accessor method as well?
  
  In either case, I'd welcome any suggestion for the right incantation to
  let the compiler know that (a self) is, in this case, a function.  I am 
  not willing to assert, however, that (a x) is a function where x is not
  an instance of foo.
  
I don't believe the type information is being used in the way you expect.
Also, when DOIT is compiled, A is simply treated as a function, rather than
recognized as a generic function.  Which as you point out can't have a type
declaration associated with it.

It would be reasonable to hope that a slot access of a typed slot would
expand into something like

  (the (and system:procedure ...) (slot self 'a))

but i doubt that happens either.

Hopefully, Jonl will give the definitive answer.
Technical Details
Message-ID: <9208101843.AA00598@news.cis.ohio-state.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bbn.com!kanderso
References: <161ssvINNamf@agate.berkeley.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bbn.com!kanderso
From: kanderso@bbn.com
Subject: Re: Optimizer--or my misunderstanding?
Message-ID: <9208101843.AA00598@news.cis.ohio-state.edu>
Sender: daemon@cis.ohio-state.edu
Organization: The Ohio State University Department of Computer and Information Science
References: <161ssvINNamf@agate.berkeley.edu>
Date: Mon, 10 Aug 1992 10:38:21 GMT
Lines: 48