[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

declaration pervasiveness.



    Received: from GODOT by AQUINAS via CHAOS with CHAOS-MAIL; Wed 12-Jun-85 20:08:52-EDT
    Received: from SU-AI.ARPA (su-ai.arpa.ARPA) by THINK.ARPA id AA09914; Wed, 12 Jun 85 20:03:40 edt
    Received: from MIT-MC.ARPA by SU-AI.ARPA with TCP; 12 Jun 85  17:04:32 PDT
    Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 12 JUN 85  19:46:52 EDT
    Date: Wed 12 Jun 85 19:44:14-EDT
    From: Rodney A. Brooks <BROOKS%MIT-OZ@MIT-MC.ARPA@think>
    Subject: declaration pervasiveness.
    To: common-lisp@SU-AI.ARPA
    Cc: jk@SU-AI.ARPA

    I'm having trouble deciding exactly how pervasive certain declarations
    are. For instance:

    (defun f (n)
      (flet ((f (m) (* m m)))
	(declare (ftype (function (integer) integer) f))
	(declare (notinline f))
	(+ (f n)
	   (flet ((f (m) (bar m m)))
	     (f n)))))

    By analogy to type it would appear that the ftype declaration applies
    to the call to the (* m m) f, but not to the (bar m m) call. There is
    specific language in the first paragraph of page 159 that implies
    that. However notinline , which has precisely the same language
    applied to it at the top of page 160, is earlier singled out has
    having nothing to do with bindings and being pervasive on page 155.

    So does the notinline apply to the call to the (bar m m) version or
    not? If not, then page 155, and the notion of pervasiveness seem
    misleading.
    -------

The notinline declaration does not apply to the call to the (bar m m) version.
The description of notinline specifically notes that lexical scoping is observed
regarding the references to function names occurring in the declaration.
So the declaration (notinline f) refers to the function named f that is visible
at that point, namely the (* m m) version.  The declaration is pervasive in that
it affects all *calls* to that specific f (not *bindings* of other functions
also named f) in the body of the construct.  The call to the (bar m m) version
is not a call to the f referred to by the notinline declaration, but to some
other f, and so is not affected by that declaration.
--Guy