Search
Active

1
Sign in to vote
3
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 508979
Opened: 11/7/2009 7:33:28 AM
Access Restriction: Public
0
Workaround(s)
Tupleクラスは、1要素から8要素まで標準テンプレートが用意されている。
最大8要素では少ない。。

Tuple(T1)
Tuple(T1,T2)
...
Tuple(T1,T2,T3,T4,T5,T6,T7,T8)
Details (expand)

対象製品

.NET Framework 4 Beta 2

オペレーティング システム

Windows Vista

提案内容

標準テンプレートの数をもっと増やし20要素まで用意する。
Tuple(T1)
Tuple(T1,T2)
...
Tuple(T1,T2, .... ,T20)

提案による改善点

開発効率の向上

その他の改善点

 
File Attachments
0 attachments
Sign in to post a comment.
Posted by biac on 11/8/2009 at 7:35 PM
Tuple (組) は、 配列やリストではありません。 むしろ、 匿名の構造体とでもいうべきものです。
構造体のメンバーが多すぎると混乱を招くことがあるように、 Tuple (組) の要素も多すぎるのは好ましくありません。

Tuple (組) のサンプルに、 いかにも配列のような例が多いので、 誤解を招いているのかもしれません。 しかし、 配列とはまったく異なるものであることは、 インデクサや IEnumerable が実装されていないことからも分かります。
仮に、 20-tuple を作ったとしましょう。 しかし、 その要素にアクセスするのに foo[19] といった構文は使えません。 foo.Item19 とか foo.Item17 とか、 ハードコーディングする必要があります。 配列代わりに使おうとすると、 ループで処理できないので、 不便なだけです。 Tuple (組) の趣旨に沿って異なるものを格納しているとすると、 Item17 は何だったのか、 Item19 は何だったのか、 記憶していられる人はどれだけ居るでしょう?

たしかに、 8個という上限は恣意的に決められたものです。 でも、 人間が一度に記憶できるのは 7個程度だと言われていることからすると、 妥当な設計でしょう。
参考までに。 8個に決定した経緯が、 MSDN マガジン 2009年 7月号に書かれています。
http://msdn.microsoft.com/ja-jp/magazine/dd942829.aspx
Posted by Microsoft on 11/8/2009 at 9:26 PM
この度は、フィードバックをお送りいただき、誠にありがとうございます。 現在、お送りいただきました報告内容に基づき問題を調査中ですので、しばらくお待ちください。 よろしくお願いいたします。

[Problem Description]
The Tuple class has standard templates to cover one to eight elements. The maximum number of the elements covered (8) is not enough...

Tuple(T1)
Tuple(T1,T2)
...
Tuple(T1,T2,T3,T4,T5,T6,T7,T8)

[Suggestion]
More standard templates should be prepared to cover up to 20 elements.

Tuple(T1)
Tuple(T1,T2)
...
Tuple(T1,T2, .... ,T20)

[Benefits]
Faster Development
Posted by Microsoft on 11/10/2009 at 12:20 AM
(翻訳者注: 2009年9月末のサイト デザイン変更に伴い、報告者以外の方のコメントも英訳の対象とさせていただくことになりました。 こちらは、biac さんが 2009/11/08 19:35 に投稿されたコメントの英訳です。)

A Tuple is like an anonymous structure rather than an array or a list. As the existence of too many structure members sometimes causes confusion, it's not good to have too many Tuple elements.

There may be misunderstanding since many Tuple samples look like an array. However, it's totally different from an array. It's clear when you look at the fact that neither Indexer nor IEnumerable is implemented.

Let's say you created 20 Tuples, you cannot use such syntax as foo[19] to access an element. You need to hardcode each element (e.g., foo.Item19 or foo.Item17). When you try to use a Tuple as an array, it's inconvenient since it cannot be handled by looping. If various things are stored based on the Tuple concept, how many people could memorize what is Item17 or Item19?

As you said, the maximum number (8) was arbitrarily decided. However, considering the fact that we can usually memorize only about 7 things at one time, this seems to be a natural design.

For your information, MSDN Magazine July 2009 Issue describes why 8 was chosen: http://msdn.microsoft.com/ja-jp/magazine/dd942829.aspx
Posted by Microsoft on 11/11/2009 at 7:11 PM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Posted by Microsoft on 11/11/2009 at 8:17 PM
(こちらは、[投稿者: Microsoft、投稿日時: 2009/11/11 19:11] の和訳です。)

フィードバックをお寄せいただき、ありがとうございます。 私たちは現在、MicroVAX さんからご投稿いただきましたフィードバックを調査しております。 もしこちらの問題が緊急の場合は、直接弊社のサポート窓口 (http://support.microsoft.com) までご連絡ください。