all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Help sought understanding shorthands wrt modules/packages
Date: Sat, 12 Nov 2022 10:11:46 +0000	[thread overview]
Message-ID: <87tu345vod.fsf@gmail.com> (raw)
In-Reply-To: <E1othJ8-0007uF-Sc@fencepost.gnu.org> (Richard Stallman's message of "Fri, 11 Nov 2022 22:35:50 -0500")

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > The magnars-string.el file is meant to supersede s.el and be a
>   > well-behaved version of it.  The s.el file, as it exists today, is a
>   > namespace-polluting liability, we shouldn't maintain it.
>
> No one would be happer than I to eliminate te usual version of s.el,
> but my understanding is that that would cause a big practical problem.
>
> Lots of packages do (require 's), and they call those functions by the
> names s-... defined in s.el.  If we don't have s.el, they will break.
> They can't use your proposed magnars-string.el (which I would call
> stris.el), since the names it would define are wrong _for them_.

I don't think you're following my plan, which was the plan all along.

Here's the story from the beginning:

* Once upon a time, s.el was a namespace polluting liability, and this
  was part of the reason why it wasn't in GNU Emacs or GNU ELPA.

* s.el was a very popular kid.  Many other packages foo.el and bar.el
  depended on it.  They were also popular.  But the namespacing
  pollution of s.el prevented us from including those in GNU ELPA, too.

* Right, so we wanted to integrate s.el into Emacs core or GNU Elpa
  "somehow", but how could we do that?

  We developed shorthands for Emacs 28.

* OK, but what did we do with them?

  We made a new file magnars-string.el which was absolutely identical to
  s.el but for the local read-symbol-shorthands cookie (and the provide
  form.)

  Then we submitted mangnars-string.el to Emacs core or GNU ELPA.

* When foo.el and bar.el wanted to enter GNU ELPA, they just upgraded
  their string library from s.el to magnars-string.el, of course.

* Oh no, but wasn't upgrading them so very complicated?

  No at all, it amounted to changing a single line, in foo.el:
    (require 's)
  to
    (require 'magnars-string)

  And adding the SAME read-symbol-shorthands cookie in the trailer of
  the file.

  ;; foo.el ends here
  ;; Local Variables:
  ;; read-symbol-shorthands: (("s-" . "magnars-string-"))
  ;; End:

* But but, what about all the the references to s-trim and s-append in
  lines 1234 and 876 of foo.el?  

  They became, magically, references to the symbols magnars-string-trim
  and magnars-string-append.

* And that's all?  They lived happily ever after?

  Yes, that's about it.  The usual copyright stuff was changed in foo.el
  and bar.el, the name of the package was endelessly bikeshed, Stefan
  Monnier submitted many patches (mostly for pcase usage), and yes, they
  lived happily.

Epilogue:

* One night, Saint Ignucius came down to tell the world not to use s.el
  anymore, because a better version had appeared in GNU land.  This
  being a world of sinners, most of it didn't listen or care.  Splitters!

  Saint Ignucius then also asked the maintainers to stop maintaining
  their s.el.  Let's presume they did listen.

  One day, some package fossil.el, which didn't listen, found a bug in
  its s.el dependency.  Should that bug have been fixed in s.el?  No, it
  was fixed in magnars-string.el.  fossil.el was told to upgrade to
  magnars-string.el, because it is very easy.  Now fossil.el was
  enlightened, too.

  Not so fast! fossil.el was meant to work on Emacs 27 and Emacs 6 and
  Emacs 500BC!  No problem, that's didn't change the plan.  fossil.el
  was upgraded to use magnars-string.el anyway.

  And that new fossil.el was loaded into Emacs 27 along with
  magnars-string.el.  They loaded fine, and the presence of the
  read-symbol-shorthands file-local variables there didn't affect it.

  And fossil.el worked just fine there.  The namespace was polluted with
  s- symbols, that's true, but the situation was no worse than before.

  One day, the user simply upgraded to Emacs 28, kept all his packages
  in the same place, and the namespace pollution simply went away.

>   >   The usual commands C-M-x, M-x load-file, M-x
>   > emacs-lisp-byte-compile-and-load will all produce wrong results that I
>   > won't know how to fix.
>
> I don't follow you.  I don't see why anything would produce wrong
> results.  If you show me a specific scenario, I might understand.

If you do these actions in the s.el file, the one where the actual code
is and the one you want to keep unchanged, it will just intern new
s-prefixed symbols in the obarray!  I.e. you won't change the renamed
symbol's definition -- the one begotten by that load-with-shorthands
call -- at all.





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

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30  6:45 Help sought understanding shorthands wrt modules/packages Gerd Möllmann
2022-10-30  8:38 ` tomas
2022-10-30  8:54   ` Eli Zaretskii
2022-10-30  9:14     ` tomas
2022-10-30 10:26       ` Gerd Möllmann
2022-10-30 10:52         ` Eli Zaretskii
2022-10-30 11:24           ` Is there a need for a module system Gerd Möllmann
2022-10-30 11:38             ` Eli Zaretskii
2022-10-30 14:03               ` Gerd Möllmann
2022-10-30 10:40       ` Help sought understanding shorthands wrt modules/packages Eli Zaretskii
2022-10-30 11:06         ` tomas
2022-10-30 11:19           ` Eli Zaretskii
2022-10-30 12:50 ` Stefan Monnier
2022-10-30 13:48   ` Gerd Möllmann
2022-10-30 14:25     ` Stefan Monnier
2022-10-31  6:31       ` Gerd Möllmann
2022-10-30 20:16 ` Helmut Eller
2022-10-31  6:27   ` Gerd Möllmann
2022-10-31 12:13     ` Juanma Barranquero
2022-10-31 12:57       ` Gerd Möllmann
2022-10-31 13:38         ` Juanma Barranquero
2022-10-31 19:53         ` Stefan Monnier
2022-11-11  4:35         ` Richard Stallman
2022-11-11  9:33           ` Gerd Möllmann
2022-11-13  4:17             ` Richard Stallman
2022-11-13  6:41               ` Gerd Möllmann
2022-11-03  3:17     ` Richard Stallman
2022-11-03  8:12       ` Michael Albinus
2022-11-03  3:17     ` Richard Stallman
2022-11-03  5:33       ` Gerd Möllmann
2022-11-03  3:17     ` Richard Stallman
2022-11-03  8:46       ` Eli Zaretskii
2022-11-05 16:49         ` Richard Stallman
2022-11-05 17:04           ` Eli Zaretskii
2022-11-07  7:47             ` Richard Stallman
2022-11-07 12:52               ` Eli Zaretskii
2022-11-08  6:19               ` Gerd Möllmann
2022-11-08  9:54                 ` João Távora
2022-11-08 10:35                   ` Gerd Möllmann
2022-11-08 15:40                     ` João Távora
2022-11-08 15:47                     ` Stefan Kangas
2022-11-08 22:43                       ` João Távora
2022-11-09  6:57                         ` Gerd Möllmann
2022-11-09  7:23                       ` Gerd Möllmann
2022-11-11  4:34                     ` Richard Stallman
2022-11-11  9:25                       ` Gerd Möllmann
2022-11-12  3:35                         ` Richard Stallman
2022-11-19 22:51                           ` [External] : " Drew Adams
2022-11-20  7:18                             ` Eli Zaretskii
2022-11-20 18:55                               ` [External] : " Drew Adams
2022-11-20 19:02                                 ` Eli Zaretskii
2022-11-22 12:14                                 ` [External] : " Richard Stallman
2022-11-22 14:22                                   ` Eli Zaretskii
2022-11-20  8:08                             ` Gerd Möllmann
2022-11-12  3:35                         ` Richard Stallman
2022-11-22 19:37                         ` Matt Armstrong
2022-11-23  7:33                           ` Juanma Barranquero
2022-11-26 23:32                             ` Richard Stallman
2022-11-27  9:05                               ` Juanma Barranquero
2022-11-30 23:55                                 ` Richard Stallman
2022-11-23  7:42                           ` Gerd Möllmann
2022-12-14 22:21                             ` Richard Stallman
2022-12-15  6:47                               ` Eli Zaretskii
2022-12-17 14:53                                 ` Richard Stallman
2022-11-22 18:01                       ` Matt Armstrong
2022-11-22 18:44                         ` Eli Zaretskii
2022-11-23  0:55                           ` Matt Armstrong
2022-11-23  7:49                             ` Gerd Möllmann
2022-11-23 12:18                             ` Eli Zaretskii
2022-11-11  4:35                 ` Richard Stallman
2022-11-11  9:35                   ` Gerd Möllmann
2022-11-11 12:09                     ` João Távora
2022-11-11 13:01                       ` Gerd Möllmann
2022-11-11 14:23                         ` João Távora
2022-11-11 15:12                           ` Gerd Möllmann
2022-11-12  9:17                             ` João Távora
2022-11-12 13:00                               ` Gerd Möllmann
2022-11-12  3:35                     ` Richard Stallman
2022-11-05 21:47           ` Eduardo Ochs
2022-11-06  9:05           ` Michael Albinus
2022-11-06 11:19             ` João Távora
2022-11-11  4:35               ` Richard Stallman
2022-11-11 10:09                 ` João Távora
2022-11-12  3:35                   ` Richard Stallman
2022-11-12 10:11                     ` João Távora [this message]
2022-11-12 14:36                       ` Dmitry Gutov
2022-11-12 15:20                         ` João Távora
2022-11-12 17:32                           ` Dmitry Gutov
2022-11-12 18:45                             ` João Távora
2022-11-14  1:03                               ` Dmitry Gutov
2022-11-14  6:33                                 ` João Távora
2022-11-14 11:41                                   ` Dmitry Gutov
2022-11-14 13:41                                     ` João Távora
2022-11-14  3:13                             ` Richard Stallman
2022-11-11  4:35             ` Richard Stallman
2022-11-11  8:53               ` Michael Albinus
2022-11-11  4:35   ` Richard Stallman
2022-11-11  7:10     ` Helmut Eller
2022-11-01  3:11 ` Ag Ibragimov
2022-11-02 20:11 ` João Távora
2022-11-03  5:12   ` Gerd Möllmann
2022-11-03 20:04     ` A short defense of shorthands.el (but CL packages are still better) (Was: Help sought understanding shorthands wrt modules/packages) João Távora
2022-11-04  3:28       ` Richard Stallman
2022-11-05  1:09         ` A short defense of shorthands.el (but CL packages are still better) João Távora
2022-11-07  7:44           ` Richard Stallman
2022-11-07 10:18             ` João Távora
2022-11-08  5:02               ` Richard Stallman
2022-11-08  5:18                 ` João Távora
2022-11-05  3:13     ` Help sought understanding shorthands wrt modules/packages Richard Stallman
2022-11-06 11:31       ` João Távora
2022-11-08  0:27         ` Matt Armstrong
2022-11-08  4:52           ` João Távora
2022-11-08  5:34             ` Gerd Möllmann
2022-11-09  4:03           ` Richard Stallman
2022-11-09  5:42             ` Yuri Khan
2022-11-09  5:48               ` tomas
2022-11-09  6:02             ` Matt Armstrong
2022-11-09  7:15               ` Juanma Barranquero
2022-11-09  8:34               ` Gerd Möllmann
2022-11-09 10:07             ` Helmut Eller
2022-11-09 18:22               ` Matt Armstrong
2022-11-09  4:03           ` Richard Stallman
2022-11-09  5:13             ` Matt Armstrong
  -- strict thread matches above, loose matches on Subject: below --
2022-11-07 21:20 Payas Relekar
2022-11-08  9:40 ` João Távora

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=87tu345vod.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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.