[Q] #'featurep byte-optimisation

Aidan Kehoe kehoea at parhasard.net
Tue Sep 4 16:41:02 EDT 2007


 Ar an cúigiú lá de mí Méan Fómhair, scríobh Steve Youngs: 

 >   > I would think a small interpreter for the featurep language is
 >   > needed.  I'll be happy to write it if it's the right thing to do.
 > 
 > I'm not sure.  I'm thinking now that the right thing to do is to leave
 > featurep as it was prior to me messing with it.

Well, literally all of the #'featurep checks for XEmacs in the packages are
of the form:

(featurep 'xemacs)

because people, reasonably enough, want the expression to return nil instead
of provoking a wrong-type-argument on GNU. We don’t need anything complex to
optimise away *that* case. For the sake of differentiating our code from
GNU’s, though, until we get sucked into GPLV3 anyway, this is an
alternative:

(defvar byte-optimize-ever-present-features 
   ;; Conservative list. 
   ;; cl-19, cl-extras, backquote are also present from early in the dump
   ;; process, but they're not checked for anywhere in packages, nor in
   ;; Google code search.
  '(xemacs cl)) 

(put 'featurep 'byte-optimizer 'byte-optimize-featurep)
(defun byte-optimize-featurep (form)
  (if (memq (car-safe
	     (cdr-safe
	      (car-safe
	       (cdr-safe 
		form))))
	    byte-optimize-ever-present-features)
      t
    form))

-- 
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)



More information about the XEmacs-Patches mailing list