all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Oleh Krehel <o.krehel@tue.nl>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] What's the quickest way to contribute?
Date: Tue, 13 Jan 2015 14:32:48 -0500	[thread overview]
Message-ID: <jwvk30q4h5o.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAJ1SQWBrr0=KPs_JDV4DhMJvab96GtD5FzgahmmdU7Ucridhmw@mail.gmail.com> (Oleh Krehel's message of "Tue, 13 Jan 2015 14:46:08 +0100")

>> I think algorithmically, it's equivalent (both are O(N), basically).
> Yes, I've used my blurry version of *algorithmically faster*, which
> means iterating on one list instead of two in succession; the
> complexity is the same, of course.

As mentioned, I expect the second traversal (the `delq') to be
negligible, because it's a simple loop 100% implemented in C (in the
mapcar, most of the time is likely to be spent in the function-call made
for each element, and in the remove-if a similar amount of time is
probably spent in interpreting the byte-code that performs the
iteration).

>> Yes, cl-* functions are definitely allowed.  There is of course a lot of
>> carried prejudice from when cl-* functions didn't exist (and we just
>> had the `remove-if-not' instead, whose use was not accepted in Emacs's
>> own code), but there is also still a restriction in this respect: cl-*
>> functions still can't be used from preloaded files (because that would
>> require preloading cl-lib).
> By preloaded files, do you mean the ones on `preloaded-file-list'?

Yes.

> There are 112 files in this list on my system, so it's quite a large
> restriction.

Indeed.  It is very slightly relaxed by the fact that some of those cl-*
functions come with compiler-macros so some calls can be used because
they can be macro-expanded away during compilation (e.g. cl-list* and
cl-caddr, and I may have a patch somewhere that does it for cl-remove-if
and cl-remove-if-not).

> Is it no-more, no-less, i.e. only these 112 files?

That's right.

> Maybe the byte compiler could do some linting to enforce this
> restriction?  It already contains a lot of checks.

There is such a check already: if you use (eval-when-compile (require
'cl-lib)), the compiler should tell you if you use a function from
cl-lib.  And if you use (require 'cl-lib) instead, the compiler will
stay silent, but the "dump" phase (where we preload the files) should
complain that you're requiring a file that isn't explicitly loaded.


        Stefan



      reply	other threads:[~2015-01-13 19:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 17:59 [PATCH] What's the quickest way to contribute? Oleh Krehel
2015-01-08 18:48 ` Eli Zaretskii
2015-01-08 19:04   ` Samer Masterson
2015-01-08 19:13     ` Dmitry Gutov
2015-01-09  0:01     ` Richard Stallman
2015-01-13  2:57 ` Dmitry Gutov
2015-01-13  5:10   ` Stefan Monnier
2015-01-13 11:15     ` Dmitry Gutov
2015-01-13 19:24       ` Stefan Monnier
2015-01-13 13:46     ` Oleh Krehel
2015-01-13 19:32       ` Stefan Monnier [this message]

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=jwvk30q4h5o.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=o.krehel@tue.nl \
    /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.