Subject: RE: bug#35508: 27.0.50; Fine-ordering of functions on hooks

From: Drew Adams <[email-masked]>
Date: Tue, 30 Apr 2019 14:37:41 -0700 (PDT)

> +But in some cases, it is important to control the relative ordering of
> +functions on the hook.  The optional argument @var{depth} lets you indicate
> +where the function should be inserted in the list: it should then be a
> number
> +between -100 and 100 where the higher the value, the closer to the end of
> the
> +list the function should go.  The @var{depth} defaults to 0 and for backward
> +compatibility when @var{depth} is a non-nil symbol it is interpreted as a
> depth
> +of 90.  Furthermore, when @var{depth} is strictly greater than 0 the
> function
> +is added @emph{after} rather than before functions of the same depth.

Commenting on just this part.  If by "default" you mean
that providing nil or no DEPTH arg has the same effect
as providing a DEPTH of 0, then I don't think that
defaulting to 0 is backward-compatible.

Currently the default behavior is to prepend.
Presumably 0 does not mean prepend but insert ~halfway.
And currently if you provide 0 as the APPEND arg you
get the effect of 100, not 0 (IIUC).

I think that if you add this feature the doc should say
something about an expected/possible use case - when
"it is important to control the relative ordering".
(I'm curious, for example, never having come across the
need.)

The way you describe it makes it seem like it will be
common to supply a specific number rather than just
appending (i.e. at the end).  Will it be common to need
a number other than 100?

BTW, do similar considerations not apply to advice?
There we have before, after, and replace, essentially.
Why don't we need -100 to 100 for ordering there?
(Again, just curious.)