unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master a3b2101 1/2: New file with obarray functions.
       [not found] ` <E1ZwYgl-0007KU-5d@vcs.savannah.gnu.org>
@ 2015-11-11 20:26   ` Stefan Monnier
  2015-11-11 20:48     ` Eli Zaretskii
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stefan Monnier @ 2015-11-11 20:26 UTC (permalink / raw)
  To: emacs-devel; +Cc: Przemysław Wojnowski

>     New file with obarray functions.
>     * lisp/obarray.el: basic obarray functions extracted from abbrev.el
>     * test/automated/obarray-tests.el: new file

Funnily enough, I think we should discourage the use of obarrays.
There are times/places where they are really indispensable (when we
really need to handle *symbols*), but in the majority of cases where
I could see this obarray.el being used, a hash-table would work better
(e.g. hash-table-p is more reliable, print+read actually works, access
is usually faster, ...).


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master a3b2101 1/2: New file with obarray functions.
  2015-11-11 20:26   ` [Emacs-diffs] master a3b2101 1/2: New file with obarray functions Stefan Monnier
@ 2015-11-11 20:48     ` Eli Zaretskii
  2015-11-11 22:33       ` Artur Malabarba
  2015-11-11 21:22     ` Przemysław Wojnowski
  2015-11-11 23:28     ` Richard Stallman
  2 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2015-11-11 20:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: esperanto, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Wed, 11 Nov 2015 15:26:53 -0500
> Cc: Przemysław Wojnowski <esperanto@cumego.com>
> 
> Funnily enough, I think we should discourage the use of obarrays.

At the very least we should fix these new warnings:

    ELC      obarray.elc

  In toplevel form:
  obarray.el:45:1:Warning: Lexical argument shadows the dynamic variable obarray
  obarray.el:50:1:Warning: Lexical argument shadows the dynamic variable obarray
  obarray.el:55:1:Warning: Lexical argument shadows the dynamic variable obarray
  obarray.el:60:1:Warning: Lexical argument shadows the dynamic variable obarray




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master a3b2101 1/2: New file with obarray functions.
  2015-11-11 20:26   ` [Emacs-diffs] master a3b2101 1/2: New file with obarray functions Stefan Monnier
  2015-11-11 20:48     ` Eli Zaretskii
@ 2015-11-11 21:22     ` Przemysław Wojnowski
  2015-11-11 23:28     ` Richard Stallman
  2 siblings, 0 replies; 6+ messages in thread
From: Przemysław Wojnowski @ 2015-11-11 21:22 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

W dniu 11.11.2015 o 21:26, Stefan Monnier pisze:
>>      New file with obarray functions.
>>      * lisp/obarray.el: basic obarray functions extracted from abbrev.el
>>      * test/automated/obarray-tests.el: new file
>
> Funnily enough, I think we should discourage the use of obarrays.
> There are times/places where they are really indispensable (when we
> really need to handle *symbols*), but in the majority of cases where
> I could see this obarray.el being used, a hash-table would work better
> (e.g. hash-table-p is more reliable, print+read actually works, access
> is usually faster, ...).
>
>
>          Stefan

Thanks for feedback.

I just extracted obarray functionality from abbrev.el. This separates 
abbrev responsibility from underlying collection type to make both 
easier to test, understand and change if needed. Replace of 
implementation was not purpose of this commit.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master a3b2101 1/2: New file with obarray functions.
  2015-11-11 20:48     ` Eli Zaretskii
@ 2015-11-11 22:33       ` Artur Malabarba
  0 siblings, 0 replies; 6+ messages in thread
From: Artur Malabarba @ 2015-11-11 22:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: esperanto, Stefan Monnier, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> 
> Funnily enough, I think we should discourage the use of obarrays.

I do to, but I like this change. `abbrev.el' is easier to understand now
and we have more tests.


Eli Zaretskii <eliz@gnu.org> writes:

> At the very least we should fix these new warnings:
>
>     ELC      obarray.elc
>
>   In toplevel form:
>   obarray.el:45:1:Warning: Lexical argument shadows the dynamic variable obarray
>   obarray.el:50:1:Warning: Lexical argument shadows the dynamic variable obarray
>   obarray.el:55:1:Warning: Lexical argument shadows the dynamic variable obarray
>   obarray.el:60:1:Warning: Lexical argument shadows the dynamic variable obarray

Done.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master a3b2101 1/2: New file with obarray functions.
  2015-11-11 20:26   ` [Emacs-diffs] master a3b2101 1/2: New file with obarray functions Stefan Monnier
  2015-11-11 20:48     ` Eli Zaretskii
  2015-11-11 21:22     ` Przemysław Wojnowski
@ 2015-11-11 23:28     ` Richard Stallman
  2015-11-12  1:35       ` Stefan Monnier
  2 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2015-11-11 23:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: esperanto, emacs-devel

[[[ 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. ]]]

  > Funnily enough, I think we should discourage the use of obarrays.
  > There are times/places where they are really indispensable (when we
  > really need to handle *symbols*), but in the majority of cases where
  > I could see this obarray.el being used, a hash-table would work better
  > (e.g. hash-table-p is more reliable, print+read actually works, access
  > is usually faster, ...).

Hash tables are a lot newer -- for a long time, obarrays were the only
Emacs data type that did hashing.  Perhaps that is why obarrays are used
in some places where hash tables would be better.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master a3b2101 1/2: New file with obarray functions.
  2015-11-11 23:28     ` Richard Stallman
@ 2015-11-12  1:35       ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2015-11-12  1:35 UTC (permalink / raw)
  To: Richard Stallman; +Cc: esperanto, emacs-devel

> Hash tables are a lot newer -- for a long time, obarrays were the only
> Emacs data type that did hashing.

Of course, it's all relative: AFAIK they were introduced in Emacs-21
(i.e. in 2001), so they've already existed for almost half of Emacs's life.

> Perhaps that is why obarrays are used in some places where hash tables
> would be better.

I indeed also believe that's the reason.


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-12  1:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20151111165602.28114.31123@vcs.savannah.gnu.org>
     [not found] ` <E1ZwYgl-0007KU-5d@vcs.savannah.gnu.org>
2015-11-11 20:26   ` [Emacs-diffs] master a3b2101 1/2: New file with obarray functions Stefan Monnier
2015-11-11 20:48     ` Eli Zaretskii
2015-11-11 22:33       ` Artur Malabarba
2015-11-11 21:22     ` Przemysław Wojnowski
2015-11-11 23:28     ` Richard Stallman
2015-11-12  1:35       ` Stefan Monnier

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