destructuring 这个字,我最早是在 clojure 中看到这名词
http://clojure.org/special_forms 在文件最下面的 binding forms (destructuring)
Clojure supports abstract structural binding, often called
destructuring, in let binding lists, fn parameter lists, and any
macro that expands into a let or fn. The basic idea is that a
binding-form can be a data structure literal containing symbols
that get bound to the respective parts of the init-expr. The
binding is abstract in that a vector literal can bind to anything
that is sequential, while a map literal can bind to anything that
is associative.
ex:
(let [[a b c & d :as e] [1 2 3 4 5 6 7]]
[a b c d e])
->[1 2 3 (4 5 6 7) [1 2 3 4 5 6 7]]
中文解释我会这么写:
destructuring 可以解释为“智慧批配”
它会以等号左边的表达式作依据,并将等号右边的值批配给此表达式中的变量。
变量可以是一个以上,这个数值分配的过程称之为“智慧批配”
虽然我用了名词“表达式”(epression),但其实精准的翻译应该要用“形式”(form)
在Lisp/Clojure中这两者是不太一样的
不过对其他程式语言来说这可能没有差那么多,使用“表达式”也比较能望文生义
然后就能说明表达式有哪些常见的模式
包括object/hash, array, etc.
名词的翻译我以意译而非直译,还有尽量让中文读起来不会困难
或许有更好的选择,还要请强者多多指教