all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "John Wiegley" <johnw@newartisans.com>
To: emacs-devel@gnu.org
Subject: Re: cl-pushnew and other functions
Date: Sun, 01 Jul 2012 22:50:49 -0500	[thread overview]
Message-ID: <m2r4suvn1i.fsf@newartisans.com> (raw)
In-Reply-To: <jwvsjddbfth.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 30 Jun 2012 00:16:30 -0400")

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>> I think the basic function in CL should just be considered part of the
>>>> Emacs Lisp language,
>>> We simply disagree.
>> Why do we disagree?

> Because I don't want to simply adopt all those Common-Lisp-isms into Elisp.
> A big reason for that is that Elisp is not compiled aggressively, so some
> design choices in Common-Lisp would be too costly in Elisp.

Well, maybe we disagree less than we think we do. :)

If something is ugly, surprising, or has semantics outside what a veteran
Elisper would expect, I think cl- is just fine -- even called-for.

What I really prefer not to see are the everyday staples getting an ugly
prefix, cluttering up mah code.  For example: push, incf, loop,
destructuring-bind (which is already too long), etc.

> Other reasons is that I do not agree with some of Common-Lisp's design
> choices (question of taste).  For a recent example, define-setf-expander is
> ugly and inefficient, so the new "core setf" does not fully support it.

Yeah, I'm totally fine with this.  If there's a callable thing called "setf"
that does what I expect 95% of the time, call me a happy camper.

I'm not advocating CL puritanism in Emacs, by no means.  I just want count-if
and remove-if to be usable, by those names, in code I intend to contribute.
I've rewritten those functions too many times to count now because they aren't
macros.  Enough!

Some CL stuff is also just better than any other equivalent we have in core.
I know loop is a macro, so we can already use it in contributed code (can't
I?), but look how well it aids readability in a use I found for it today

Before:

    (defun gnus-harvest-bbdb-complete-stub (stub)
      (delete
       nil
       (mapcar
        #'(lambda (record)
            (let ((nets (bbdb-record-mail record)))
              (and nets
                   (format "%s <%s>" (bbdb-record-name record)
                           (car nets)))))
        (bbdb-search (bbdb-records) stub nil stub))))

After:

    (defun gnus-harvest-bbdb-complete-stub (stub)
      (loop for record in (bbdb-search (bbdb-records) stub nil stub)
            for nets = (bbdb-record-mail record)
            when nets
            collect (format "%s <%s>" (bbdb-record-name record) (car nets))))

I breathed a sigh of relief there, just reading that again.

John



  parent reply	other threads:[~2012-07-02  3:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29  4:38 cl-pushnew and other functions John Wiegley
2012-06-29 16:53 ` Stefan Monnier
2012-06-29 20:36   ` PJ Weisberg
2012-06-29 22:17   ` John Wiegley
2012-06-30  4:16     ` Stefan Monnier
2012-06-30  5:44       ` Helmut Eller
2012-07-02  3:50       ` John Wiegley [this message]
2012-07-02  7:25         ` Andreas Schwab
2012-07-04  5:04       ` John Wiegley
2012-07-04 12:31         ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=m2r4suvn1i.fsf@newartisans.com \
    --to=johnw@newartisans.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.