unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Steve Youngs <steve@sxemacs.org>
To: emacs-devel@gnu.org
Subject: Re: [PATCH] New convenience macros
Date: Fri, 24 Aug 2007 04:24:04 +1000	[thread overview]
Message-ID: <microsoft-free.87fy2akt2z.fsf@youngs.au.com> (raw)
In-Reply-To: jwvd4xeb9c5.fsf-monnier+emacs@gnu.org

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

* Stefan Monnier <monnier@iro.umontreal.ca> 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)

Or...

  (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
`a'. 

  > 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)
        form)))

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

  (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
boolean.

(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!          |
|------------------------------------<steve@sxemacs.org>---|
-----BEGIN PGP SIGNATURE-----
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/>

iEYEARECAAYFAkbN0MQACgkQHSfbS6lLMAPRPwCg2o8ZRzKBdye0uE6gC8cvrtlV
rc8AoInzF9abCMpo5TovqRdFW2UnMn97
=+Ds3
-----END PGP SIGNATURE-----

  reply	other threads:[~2007-08-23 18:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-18 14:30 [PATCH] New convenience macros Steve Youngs
2007-08-19 15:52 ` Richard Stallman
2007-08-20  2:06   ` Steve Youngs
2007-08-20 10:58     ` Kim F. Storm
2007-08-20 18:30     ` Richard Stallman
2007-08-23 10:54       ` Steve Youngs
2007-08-23 14:12         ` Johan Bockgård
2007-08-23 14:47         ` Stefan Monnier
2007-08-23 18:24           ` Steve Youngs [this message]
2007-08-23 19:12             ` Stefan Monnier
2007-08-26 14:52               ` Steve Youngs
2007-08-26 22:47                 ` Richard Stallman
2007-08-27  3:20                   ` Steve Youngs
2007-08-20  4:09 ` Stefan Monnier
2007-08-23 11:13   ` Steve Youngs
2007-08-23 15:11     ` Stefan Monnier
2007-08-23 18:24       ` Steve Youngs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=microsoft-free.87fy2akt2z.fsf@youngs.au.com \
    --to=steve@sxemacs.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).