"structured bindings" 对比 "decomposition declarations"

"structured bindings" vs "decomposition declarations"

观察:

Decomposition declarations. [..] Was originally called "structured bindings".

[..] C++17 decomposition declarations (the feature formerly known as "structured bindings").

问题:

根据 P0615 中的措辞,新的正确名称将是 "structured binding declaration"。基本上,在:

auto [x,y] = Point(4,2);

完整的语句称为 "structured binding declaration",而标识符 xy 称为 "structured bindings"。这些将成为 C++17 中的官方术语。事实上,最新的草稿部分现在标题为 Structured Binding Declarations


问题是有两个概念,需要两个不同的名字——所以原来的措辞文件使用分解声明作为声明语句(术语"structured binding"根本没有出现在措辞中)。然而,对于大多数用户来说,这很愚蠢,因为只有一个概念——结构化绑定——所以拥有两个不同的名称更难学习。如果编译器错误消息在其消息中使用 "decomposition declaration",则尤其令人困惑。无论使用术语 "decomposition declaration,",功能的名称始终是结构化绑定。

在科纳,EWG 决定保留这两个名称,但至少让它们听起来密切相关。