unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Warning compiling obarray.el on master
@ 2017-03-17  8:59 Eli Zaretskii
  2017-03-18 12:49 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-03-17  8:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

    ELC      ../lisp/obarray.elc

  In toplevel form:
  obarray.el:40:1:Warning: Lexical argument shadows the dynamic variable obarray



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

* Re: Warning compiling obarray.el on master
  2017-03-17  8:59 Warning compiling obarray.el on master Eli Zaretskii
@ 2017-03-18 12:49 ` Stefan Monnier
  2017-03-18 13:30   ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2017-03-18 12:49 UTC (permalink / raw)
  To: emacs-devel

>     ELC      ../lisp/obarray.elc
>   In toplevel form:
>   obarray.el:40:1:Warning: Lexical argument shadows the dynamic variable obarray

It's "harmless" and it's the result of having a global variable with
a short name like `obarray` which hence unavoidably collides with
local uses.

I see the rest of obarray.el uses the name `ob` for local variables
instead, so I guess using that in `obarray-copy` is the best fix in the
short term.
In the longer term, maybe we should rename `obarray` to something more
descriptive and less likely to collide with a local var.
Maybe `default-obarray` or `global-obarray` or
`global-identifier-obarray`?


        Stefan




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

* Re: Warning compiling obarray.el on master
  2017-03-18 12:49 ` Stefan Monnier
@ 2017-03-18 13:30   ` Eli Zaretskii
  2017-03-18 13:47     ` Lars Ingebrigtsen
  2017-03-18 16:32     ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2017-03-18 13:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sat, 18 Mar 2017 08:49:05 -0400
> 
> I see the rest of obarray.el uses the name `ob` for local variables
> instead, so I guess using that in `obarray-copy` is the best fix in the
> short term.

Please do.

> In the longer term, maybe we should rename `obarray` to something more
> descriptive and less likely to collide with a local var.
> Maybe `default-obarray` or `global-obarray` or
> `global-identifier-obarray`?

Perhaps, but the danger of clashing names doesn't go away with these
measures, it just gets lower.



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

* Re: Warning compiling obarray.el on master
  2017-03-18 13:30   ` Eli Zaretskii
@ 2017-03-18 13:47     ` Lars Ingebrigtsen
  2017-03-18 14:00       ` Noam Postavsky
  2017-03-18 16:32     ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2017-03-18 13:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> In the longer term, maybe we should rename `obarray` to something more
>> descriptive and less likely to collide with a local var.
>> Maybe `default-obarray` or `global-obarray` or
>> `global-identifier-obarray`?
>
> Perhaps, but the danger of clashing names doesn't go away with these
> measures, it just gets lower.

And not using the optional OBARRAY parameter in `intern' was marked as
obsolete a few years ago.  I think that was a mistake, but changing all
the code that says (intern "foo" obarray) now to
(intern "foo" global-identifier-obarray) wouldn't be, er, optimal, either.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: Warning compiling obarray.el on master
  2017-03-18 13:47     ` Lars Ingebrigtsen
@ 2017-03-18 14:00       ` Noam Postavsky
  2017-03-18 14:05         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2017-03-18 14:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, Stefan Monnier, Emacs developers

On Sat, Mar 18, 2017 at 9:47 AM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> And not using the optional OBARRAY parameter in `intern' was marked as
> obsolete a few years ago.  I think that was a mistake, but changing all
> the code that says (intern "foo" obarray) now to
> (intern "foo" global-identifier-obarray) wouldn't be, er, optimal, either.

I think you are mixing up intern (for which the optional OBARRAY is
not obsolete), with unintern which is much more rare. A quick grep
finds only 1 use of unintern with the global 'obarray':

./obsolete/old-whitespace.el:780:
  (if (unintern "whitespace-unload-hook" obarray)



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

* Re: Warning compiling obarray.el on master
  2017-03-18 14:00       ` Noam Postavsky
@ 2017-03-18 14:05         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2017-03-18 14:05 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Eli Zaretskii, Stefan Monnier, Emacs developers

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> I think you are mixing up intern (for which the optional OBARRAY is
> not obsolete), with unintern which is much more rare. A quick grep
> finds only 1 use of unintern with the global 'obarray':

Oh, sorry.  I misremembered.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: Warning compiling obarray.el on master
  2017-03-18 13:30   ` Eli Zaretskii
  2017-03-18 13:47     ` Lars Ingebrigtsen
@ 2017-03-18 16:32     ` Stefan Monnier
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2017-03-18 16:32 UTC (permalink / raw)
  To: emacs-devel

> Perhaps, but the danger of clashing names doesn't go away with these
> measures, it just gets lower.

True, but that applies to most/all global variables we have.
And it's important to take into account that the reason why the danger
is reduced is not just because "longer names are more rare and contain
more entropy" or something like that, but because the longer name better
describes the variable, so it reduces the risk that someone else will
use that same identifier to refer to something different.


        Stefan




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

end of thread, other threads:[~2017-03-18 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-17  8:59 Warning compiling obarray.el on master Eli Zaretskii
2017-03-18 12:49 ` Stefan Monnier
2017-03-18 13:30   ` Eli Zaretskii
2017-03-18 13:47     ` Lars Ingebrigtsen
2017-03-18 14:00       ` Noam Postavsky
2017-03-18 14:05         ` Lars Ingebrigtsen
2017-03-18 16:32     ` 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).