Email list hosting service & mailing list manager

mutation naming conventions Alex Shinn (24 May 2023 02:08 UTC)
Re: mutation naming conventions Marc Nieper-Wißkirchen (24 May 2023 05:59 UTC)
Re: mutation naming conventions Alex Shinn (24 May 2023 08:28 UTC)
Re: mutation naming conventions Marc Nieper-Wißkirchen (24 May 2023 08:53 UTC)
Re: mutation naming conventions Alex Shinn (24 May 2023 10:10 UTC)
Re: mutation naming conventions Marc Nieper-Wißkirchen (25 May 2023 16:30 UTC)
Re: mutation naming conventions Shawn Wagner (31 May 2023 00:11 UTC)
Re: mutation naming conventions Wolfgang Corcoran-Mathe (25 May 2023 17:34 UTC)

Re: mutation naming conventions Marc Nieper-Wißkirchen 25 May 2023 16:30 UTC

Am Mi., 24. Mai 2023 um 12:10 Uhr schrieb Alex Shinn <xxxxxx@gmail.com>:

[...]

> Apologies for the confusion!  I had been looking at the R5RS info
> page since that's readily available in Emacs and forgot about the
> update.  It's been a very long time...  Similarly the prose was updated
> for vector-map but does not match SRFI 133.

I think SRFI 133 is going to be updated for R7RS large
(https://codeberg.org/scheme/r7rs/issues/113).

> However, the "!" convention description is unmodified from R5RS,
> which doesn't apply that rule the way you suggest (R5RS map
> had no such guarantee).

No Scheme standard forces to use "!" when an existing location in the
store is modified (most obvious with the I/O procedures), so there's
no contradiction here.

> More generally, it seems the community has largely agreed with
> the R5RS convention and my interpretation and only used "!" for
> explicit mutation of inputs (modulo linear update).  The large
> language already includes procedures which don't give this
> guarantee and yet don't have "!" in their name (e.g. hash-table-map
> from (scheme hash-table)).  I think it's too late to change this
> convention.

It would be good to update hash-table-map as described in issue 113
(cited above). For raw speed (and where the purely functional subset
of Scheme is not needed), there is already hash-table-map!.

That said, I believe that using the same suffix "!" for procedures
where mutation is a desired and required side-effect (like in
vector-set!) and for procedures where mutation is an allowed
side-effect (like in reverse! or array-copy!) is not optimal. A
different suffix like "%" (standing for unsafe/optimized/raw/...) can
reduce confusion. So reverse% and array-copy%. In R7RS large, the
linear update procedures of SRFI 1 can be aliased to use the "%"
suffix. (I do not belong to the faction that thinks that SRFI 1 is
sacrosanct and untouchable, but I understand that there would be
resistance to replace (instead of just alias) reverse! and friends.)