Ordering Linus Björnstam (15 Aug 2019 09:24 UTC)
Re: Ordering Amirouche Boubekki (15 Aug 2019 10:07 UTC)
Re: Ordering Amirouche Boubekki (15 Aug 2019 10:20 UTC)
Re: Ordering Lassi Kortela (15 Aug 2019 17:17 UTC)

Re: Ordering Amirouche Boubekki 15 Aug 2019 10:07 UTC

Le jeu. 15 août 2019 à 11:24, Linus Björnstam
<xxxxxx@veryfast.biz> a écrit :
>
> Hi!

Hello Linus,

Thanks for chiming in!

> I see that guile strict ordering has been removed in favour of not specifying any order. What is the reasoning behind that?

Several reasons:

- Fixing the order of hook invocation in a real world scenario where
hooks are used to implement plugins using only (add-hook! hook proc
[append_p]) is not possible in all cases. The append_p which put the
procedure at the end of the hook is a weak and partial solution to
some coupling between the hook's procedures that should not happen in
the first place.

- The abstract of the SRFI says:

> the execution of arbitrary code with the execution of the program without introducing any coupling between the two.

As such, hook's procedures should not introduce coupling with the
hosting application or between the procedures. Relying on the order of
execution between the hook's procedure will introduce coupling which
can break next time a procedure is added to the hook.

- The CL hooks library does not rely on order:
https://quickref.common-lisp.net/cl-hooks.html#Exported-functions

>  I know that relying on order is bad practice and asking for trouble

Exactly.

> Since the spec relies on mutation (which is probably the sane way to do it) implementations already have to take care when hooks are used/modified in a multithreaded environment, so the extra burden on specifying order is really not that big

In the case of multithread environment the ordering would not be
deterministic, so there is no point in prescribing order.

--
Amirouche ~ amz3 ~ https://hyper.dev