unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 9d8d065: Add support for finalizers
       [not found] ` <E1YSZvy-0004vW-Tc@vcs.savannah.gnu.org>
@ 2015-03-03 17:03   ` Stefan Monnier
  2015-03-03 17:08     ` Daniel Colascione
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-03-03 17:03 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Colascione

Was this discussed on emacs-devel and I missed it?

Question: why use a doubly-linked list, unlike pretty much everything
else in our code base?


        Stefan


> +  DEFVAR_BOOL ("gc-precise-p", gc_precise_p,

This name is wrong.  "-p" stands for "predicate" and a predicate is
a function that returns a boolean, whereas this is a variable/constant.



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

* Re: [Emacs-diffs] master 9d8d065: Add support for finalizers
  2015-03-03 17:03   ` [Emacs-diffs] master 9d8d065: Add support for finalizers Stefan Monnier
@ 2015-03-03 17:08     ` Daniel Colascione
  2015-03-03 18:18       ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Colascione @ 2015-03-03 17:08 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

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

On 03/03/2015 09:03 AM, Stefan Monnier wrote:
> Was this discussed on emacs-devel and I missed it?

No.

> Question: why use a doubly-linked list, unlike pretty much everything
> else in our code base?

We remove finalizers from the middle of the list in unchain_finalizer.
We could just rebuild the list as we scan it, but when we'd have to
touch every node. Or we could maintain auxiliary state, but then in
run_finalizers we'd have to scan the whole list instead of the part
we're running.

>> +  DEFVAR_BOOL ("gc-precise-p", gc_precise_p,
> 
> This name is wrong.  "-p" stands for "predicate" and a predicate is
> a function that returns a boolean, whereas this is a variable/constant.

I've also seen it for boolean-valued variables.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [Emacs-diffs] master 9d8d065: Add support for finalizers
  2015-03-03 17:08     ` Daniel Colascione
@ 2015-03-03 18:18       ` Stefan Monnier
  2015-03-03 18:23         ` Daniel Colascione
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-03-03 18:18 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: emacs-devel

>> Question: why use a doubly-linked list, unlike pretty much everything
>> else in our code base?
> We remove finalizers from the middle of the list in unchain_finalizer.
> We could just rebuild the list as we scan it, but when we'd have to
> touch every node. Or we could maintain auxiliary state, but then in
> run_finalizers we'd have to scan the whole list instead of the part
> we're running.

You can remove them from the middle of the list with a singly-linked
list as well, by keeping a "double-indirection" pointer.  That's what we
do for markers.
It's not ideal, but it's no worse than using doubly-linked lists.

>>> +  DEFVAR_BOOL ("gc-precise-p", gc_precise_p,
>> This name is wrong.  "-p" stands for "predicate" and a predicate is
>> a function that returns a boolean, whereas this is a variable/constant.
> I've also seen it for boolean-valued variables.

Oh, yes, you're not the only one introducing such horrors, but we should
still avoid making things worse in this respect.


        Stefan



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

* Re: [Emacs-diffs] master 9d8d065: Add support for finalizers
  2015-03-03 18:18       ` Stefan Monnier
@ 2015-03-03 18:23         ` Daniel Colascione
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Colascione @ 2015-03-03 18:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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

On 03/03/2015 10:18 AM, Stefan Monnier wrote:
>>> Question: why use a doubly-linked list, unlike pretty much everything
>>> else in our code base?
>> We remove finalizers from the middle of the list in unchain_finalizer.
>> We could just rebuild the list as we scan it, but when we'd have to
>> touch every node. Or we could maintain auxiliary state, but then in
>> run_finalizers we'd have to scan the whole list instead of the part
>> we're running.
> 
> You can remove them from the middle of the list with a singly-linked
> list as well, by keeping a "double-indirection" pointer.  That's what we
> do for markers.
> It's not ideal, but it's no worse than using doubly-linked lists.

Yes, of course. That's why I should wait a few seconds before sending
emails. :-) That scheme still complicates iteration, though. Besides:
it's a Lisp_Misc. We're not going to make it any smaller by leaving out
the extra links.

>>>> +  DEFVAR_BOOL ("gc-precise-p", gc_precise_p,
>>> This name is wrong.  "-p" stands for "predicate" and a predicate is
>>> a function that returns a boolean, whereas this is a variable/constant.
>> I've also seen it for boolean-valued variables.
> 
> Oh, yes, you're not the only one introducing such horrors, but we should
> still avoid making things worse in this respect.

Fixed.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-03-03 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150302233934.18904.59563@vcs.savannah.gnu.org>
     [not found] ` <E1YSZvy-0004vW-Tc@vcs.savannah.gnu.org>
2015-03-03 17:03   ` [Emacs-diffs] master 9d8d065: Add support for finalizers Stefan Monnier
2015-03-03 17:08     ` Daniel Colascione
2015-03-03 18:18       ` Stefan Monnier
2015-03-03 18:23         ` Daniel Colascione

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