From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani
> After the recent rewrite, pcase-lambda is broken. For example, ev= al the
> following to get 46422 instead of the correct value 65535.
>=C2=A0 =C2=A0 (cl-some (pcase-lambda (`[fullsweep_after ,v]) v)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'([min_bin_vheap_si= ze 46422]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[min_heap_size 2= 33]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[fullsweep_after= 65535]
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[minor_gcs 40]))=
Indeed, that's the semantics I chose.
The previous semantics was for the function to do nothing and return nil
if the arg doesn't match.=C2=A0 The new semantics is the same as the on= e used
by pcase-let.=C2=A0 It's not without its fault of course, but at least = it does
correspond to the usual idea of "destructuring" and generates mor= e
efficient code.
I think if you prefer to return nil, then the macro should look like
=C2=A0 =C2=A0(pcase-lambda ((`[fullsweep_after ,v]) v))
which would then naturally let you add additional cases like
=C2=A0 =C2=A0(pcase-lambda ((`[fullsweep_after ,v]) v)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((`[min_heap_= size ,v]) (/ v 2)))
Admittedly, for the current pcase-lambda (and pcase-let) macro, the
pcase.el code should be refined so as to emit a warning when it ends up
ignoring a constant like `fullsweep_after' above.