[Top][All Lists]

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

Re: [PATCH] New convenience macros

From: Steve Youngs
Subject: Re: [PATCH] New convenience macros
Date: Fri, 24 Aug 2007 04:24:04 +1000
User-agent: Gnus/5.110007 (No Gnus v0.7) SXEmacs/22.1.7 (De Lorean, linux)

Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

* Stefan Monnier <address@hidden> writes:

  >> (if (and (featurep 'simple) (featurep 'xemacs)) a b)
  >> warns about free variables for both `a' and `b'.  So I think having the

  > That's a valid criticism, but I fail to see how your macros would fare any
  > better on the above kind of code.  I.e. what code would you write instead of
  > the above, using your macros?

  (or (do-in-xemacs (when (featurep 'simple) a)) b)


  (with-emacs-type 'xemacs (when (featurep 'simple) a))
  (with-emacs-type 'emacs b)

Both only warn about `b' and the resulting bytecode has no mention of

  > PS: Of course while Johan's comment that the compiler could do
  > better is true, the fact is that it currently doesn't and that
  > noone has volunteered to improve it in this respect.

The same thing is happening in SXEmacs, BTW, with a similar optimisation
to Emacs' #'byte-optimize-featurep.  My version looks like...

  (defun byte-optimize-featurep (form)
    (let ((str (prin1-to-string (cdr-safe form))))
      (if (string-match #r"\s-+s?xemacs\(\s-\|)\)" str)
          (byte-optimize-predicate form)

I had to string-match it to cater for (S)XEmacs' advanced featurep

  (featurep '(and foo bar (not (or baz biz))))

At first I thought it was #'byte-optimize-predicate, but because you
guys don't use that and you do have the same problem, it can't be that.
I think the real problem lies in lisp's boolean function not being truly

(or list_of_stuff) is traversed left-to-right and first non-nil wins.
#'and is the same, left-to-right, first nil wins (lose?), otherwise last
cons-car wins.

Sorry, I don't have a solution, but I'll certainly let you know if and
when I do. :-)

|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
|       SXEmacs - The only _______ you'll ever need.       |
|         Fill in the blank, yes, it's THAT good!          |
Version: GnuPG v2.0.3 (GNU/Linux)
Comment: The SXEmacs Project <http://www.sxemacs.org>
Comment: Eicq - The SXEmacs ICQ Client <http://www.eicq.org/>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]