emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace trivial pcase occurrences in the Emacs sources


From: Garreau\, Alexandre
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Thu, 01 Nov 2018 02:40:23 +0100
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian

On 2018-10-30 at 21:54, Eli Zaretskii wrote:
> No, I think "destructuring" is about right.  How about this text:
>
>   @dfn{Destructuring} of an object is an operation that extracts
>   multiple values stored in the object, e.g., the 2nd and the 3rd
>   element of a list or a vector.  @dfn{Destructuring binding} is
>   similar to a local binding (@pxref{Local Variables}), but it gives
>   values to multiple elements of a variable by extracting those values
>   from an object of compatible structure.

“(car list)” is extracting a value stored in an object, yet it’s not
destructuring (though a list is a structure).  Nor even is “(cons (car
list) (caddr list))” or “(setq a (nth 1 list) b (nth 2 list))”.

I’d say destructuring, like in python (so to stop referring ocaml) “a,b
= 2,3”, implies a “specification reflecting the structure”, so “a,b”
*has* to be a pair/two-elements array/list/whatever.  So how about:

  @dfn{Destructuring} of an object is an operation that extracts
  multiple values stored in the object, by speciying a structure
  reflecting it, e.g., the 2nd and the 3rd element of a 3-elements list
  or a vector.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]