Re: Proposed breaking change in draft 3/extensible-match 0.875: rename ‘apply’ patterns to ‘=>’ patterns Daphne Preston-Kendal (29 Oct 2025 10:43 UTC)

Re: Proposed breaking change in draft 3/extensible-match 0.875: rename ‘apply’ patterns to ‘=>’ patterns Daphne Preston-Kendal 29 Oct 2025 10:43 UTC

I think in prose I will also refer to ? and => as ‘transformation patterns’ (a name from Andreas Rossberg’s HaMLet S).

? patterns will be ‘boolean transformation patterns’ and => patterns will be ‘value transformation patterns’. (Tatpuruṣa compounds where the first element is the locative of motion, not ablative. They transform *to* booleans and arbitrary values respectively, not *from*.)

Daphne

On 29 Oct 2025, at 10:33, Daphne Preston-Kendal <xxxxxx@nonceword.org> wrote:

> In the next draft I propose to rename the ‘apply’ pattern syntax to ‘=>’.
>
> I chose ‘apply’ as an expansion of Racket’s ‘app’, an abbreviation I considered to be specifically derived from Racket’s ‘#%app’ and thus irrelevant to standard Scheme. But the ‘apply’ pattern is not a deconstructive form of the constructive ‘apply’ procedure. Moreover, it is theoretically possible to conceive of a pattern which would be such a form, but the current name of the ‘procedural view’ syntax is hogging the most obvious name for that pattern.
>
> => has no meaning in ordinary Scheme code and so does not have this problem. It visually encapsulates the idea of passing values through to other subpatterns. There is no analogous constructive form in Scheme to how this pattern deconstructs, so auxiliary syntax is appropriate. (It would be something like a form that would construct a record given only one field value.)
>
> In Wright’s matcher this pattern is called ‘=’, but it also isn’t a deconstructive form of the = procedure.* I speculate that Wright chose = because Wadler used an infix = to define views in Miranda, but that in turn is by analogy to definitions in general in Miranda and likewise isn’t applicable to Scheme. => in this context is only slightly analogous to its use in ‘cond’ and ‘case’ (and moreover, here it will be prefix where in those it is infix) but since it is an auxiliary keyword anyway, I feel at liberty to recycle it. Since the first character is still =, it still feels like an appropriate tribute to the Wright pattern matcher.
>
> If there are any counter-proposals or objections, let me know.
>
>
> Daphne
>
> (* I am not sure when he added it, or if he may have even removed it at some point. The version of the documentation dated 1996, linked in the SRFI references section, doesn’t have it, nor does the source code of the version dated 1994, but this version dated 1995 does <https://3e8.org/pub/scheme/doc/match.pdf> He called it a field pattern but, like Racket’s ‘app’ and the form in SRFI 262, it could be used to invoke any procedure on its subject and not only a field accessor.)
>