unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'" <help-gnu-emacs@gnu.org>
Subject: `cl-macs'    [was: about keysee]
Date: Sun, 11 Dec 2022 17:09:42 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488F20CA1D149B9B8EDF3CAF31E9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]

> >> For that, you can just use `M-x load-library' to load
> >> `cl-macs.el' and `M-x load-file to load `sortie.el'
> >> and then `keysee.el'.
> 
> You should never need to load/require explicitly `cl-macs`.
> Instead you should load/require `cl-lib` (which will then load cl-macs
> and other parts of cl-lib as/when needed).
> If you need to manually load `cl-macs` there's probably a bug somewhere.

`cl-macs' is autoloaded by `cl-lib'/`cl-loaddefs'.
So you don't need to load it explicitly if you
instead load `cl-lib'.  Of course.

But there's no need to load `cl-lib' or `cl', if
all you want is a macro from `cl-macs'.  Keysee
uses just 2 macros, nothing else from `cl*', and
both are in `cl-macs'.

Occam says "Just pull in what you really need."

(Same thing applies to a function definition,
but macros are often needed only when compiling,
in which case requiring them only at compile
time doesn't add libraries to your session.)

It's not about _needing_ to load `cl-macs'.  It's
about needing _only_ `cl-macs', and _not_ all of
`cl-lib'.  (And for older Emacs, not all of `cl'.)

If you just need a macro then you just need to
load the file that defines it (unless the macro 
definition needs some other file, of course).

Or to use your language, "You should never need to
load/require explicitly" cl-lib if all you need is
available from just cl-macs.  No?

Why should using `keysee' require you to also add
`cl-lib' to your session?  That's overreach.  I'd
sooner code without using something as simple as
`cl-case' than oblige someone to load `cl-lib'
just because I've used `cl-case'.

[And yes, things like `case' should just be part
of Emacs (just as `push' is).  And yes, `pcase'
is overkill for the simple variable-value case.]

[Plus, things have changed in `cl*' world over the
years.  What's there, and where, for older Emacs
can differ from what's there, and where, for more
recent releases.  Libraries that are usable with
multiple releases don't necessarily follow a "do
this" injunction that makes sense only for some
later releases.]

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13677 bytes --]

             reply	other threads:[~2022-12-11 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11 17:09 Drew Adams [this message]
2022-12-11 17:35 ` `cl-macs' [was: about keysee] Stefan Monnier
2022-12-11 21:35   ` [External] : " Drew Adams
2022-12-12  0:05     ` Issue building master Ergus via Users list for the GNU Emacs text editor
2022-12-12 15:56     ` [External] : Re: `cl-macs' [was: about keysee] Stefan Monnier via Users list for the GNU Emacs text editor

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=SJ0PR10MB5488F20CA1D149B9B8EDF3CAF31E9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
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).