※一部、英文及び仏文を自動翻訳した日本語訳を使用しています。
序文
ISO (国際標準化機構) と IEC (国際電気標準会議) は、世界標準化のための専門システムを形成しています。 ISO または IEC のメンバーである国家機関は、技術活動の特定の分野を扱うために、それぞれの組織によって設立された技術委員会を通じて、国際規格の開発に参加しています。 ISO と IEC の技術委員会は、相互に関心のある分野で協力しています。 ISO および IEC と連携して、政府および非政府の他の国際機関もこの作業に参加しています。情報技術の分野では、ISO と IEC が合同技術委員会 ISO/IEC JTC 1 を設立しました。
国際規格は、ISO/IEC 指令で指定された規則に従って起草されます。 2.
合同技術委員会の主な任務は、国際規格を作成することです。合同技術委員会によって採択された国際規格草案は、投票のために各国の機関に回覧されます。国際規格として発行するには、投票を行う国の機関の少なくとも 75% による承認が必要です。
例外的な状況では、合同技術委員会は、次のいずれかのタイプのテクニカル レポートの発行を提案することができます。
- タイプ 1: 国際規格の発行に必要なサポートが得られない場合、何度も努力したにもかかわらず、
- タイプ 2, 主題がまだ技術開発中である場合、またはその他の理由により、国際規格に関する合意の可能性はあるが、すぐには実現できない場合。
- タイプ 3 は、合同技術委員会が、国際規格として通常公開されているものとは異なる種類のデータ (例えば、「最先端」) を収集した場合です。
タイプ 1 およびタイプ 2 のテクニカル レポートは、発行から 3 年以内に審査され、国際規格に変換できるかどうかが決定されます。タイプ 3 のテクニカル レポートは、それらが提供するデータがもはや有効または有用でないと見なされるまで、必ずしもレビューする必要はありません。
このドキュメントの要素の一部が特許権の対象となる可能性があることに注意してください。 ISO および IEC は、そのような特許権の一部またはすべてを特定する責任を負わないものとします。
ISO/IEC TR 25438 は、Ecma International によって (Ecma TR/89 として) 作成され、合同技術委員会 ISO/IEC JTC 1, 情報技術によって、特別な「ファスト トラック手順」の下で採用されました。 ISO および IEC の国家機関。
序章
このテクニカル レポートでは、言語の相互運用を促進することにより、CLI の共通言語の性質を強化することを目的とした型のコレクションを定義しています。コレクションには、一般的なタプル、関数、アクション、オプションの値の表現、2 つの異なる型のいずれかの値を含むことができる型、およびユーティリティ フィラー型が含まれます。
これらのタイプは実験的なものであり、CLI 国際標準の将来のバージョンに含めることが検討されます。 C# で記述された参照実装が含まれています (付属のファイル CommonGenericsLibrary.cs を参照してください)この実装ソースは http://kahu.zoot.net.nz/ecma からも入手できます。バイナリ バージョンも、提案の更新と共に、そのサイトから入手できます。
これらのタイプに関するフィードバックをお寄せください。 (コメントは ecmacli@zoot.net.nz までお送りください。)
1 スコープ
CLI 標準ライブラリ (ISO/IEC 23271) は、複数の言語で使用できる一般的な型のコレクションを提供します。 CLI にジェネリックが追加されたことで、標準ライブラリが拡張され、特定のコレクションなど、多くの一般的なジェネリック型が含まれるようになりました。ただし、現在、これらのライブラリには、多くの異なる言語で見られる単純なジェネリック型が多く含まれていません。これらの一般的な型を使用する言語は、CLI ライブラリに任せるのではなく、それらを実装する必要があるため、言語の相互運用性が低下します。このテクニカル レポートでは、これらの一般的なタイプをいくつか提供することで、この問題に対処しています。
汎用タプル (製品型) は、C++ ( template Pair )、Ada, Haskell, および標準 ML (SML) などの多くの言語で標準です。ただし、言語によって、標準ライブラリでサポートされる定義済みのタプル サイズの数が異なります。たとえば、C++ は 1 つ (ペア) しか提供しませんが、Haskell は 8 つ (サイズ 2 から 9) を提供し、SML は任意のサイズのタプルを許可します。このテクニカル レポートでは、9 つ (サイズ 2 ~ 10) を提供します。
ジェネリック プログラミングは、ジェネリック関数 (メソッド) がジェネリック型を持つ関数 (デリゲート) 型引数を取る "高次" プログラミングを奨励します。例には、Ada のwithおよびジェネリック制約、および Haskell と SML の関数引数が含まれます。 CLI では、関数値はデリゲートの形式で提供されるため、この提案では、関数 (値を返す) とプロシージャ (値を返さない) の標準的なジェネリック デリゲート タイプを定義します。
いくつかの言語で発生する別の 2 つのタイプはオプションのタイプで、他のタイプの値を含むか、そのような値が存在しないことを示します。 2 つの可能なタイプのうちの 1 つの値と、どちらが存在するかを示すいずれかのタイプ。この提案は、これらの両方を提供します。
オプションの型はSystem.Nullable型と似ていますが、異なります。
最後に、既存のジェネリック言語では、ジェネリック型の特定の用途に特定のジェネリック パラメータが必要ない場合に、フィラー型を使用する必要があることがわかっています。多くの場合、この目的のために、 UnitorVoidと呼ばれる標準的な 1 つの値の型が提供されます。このテクニカル レポートには、そのようなタイプが含まれます。
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, 2.
The main task of the joint technical committee is to prepare International Standards. Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an International Standard requires approval by at least 75 % of the national bodies casting a vote.
In exceptional circumstances, the joint technical committee may propose the publication of a Technical Report of one of the following types:
- type 1, when the required support cannot be obtained for the publication of an International Standard, despite repeated efforts;
- type 2, when the subject is still under technical development or where for any other reason there is the future but not immediate possibility of an agreement on an International Standard;
- type 3, when the joint technical committee has collected data of a different kind from that which is normally published as an International Standard (“state of the art”, for example).
Technical Reports of types 1 and 2 are subject to review within three years of publication, to decide whether they can be transformed into International Standards. Technical Reports of type 3 do not necessarily have to be reviewed until the data they provide are considered to be no longer valid or useful.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
ISO/IEC TR 25438 was prepared by Ecma International (as Ecma TR/89) and was adopted, under a special “fast-track procedure”, by Joint Technical Committee ISO/IEC JTC 1, Information technology, in parallel with its approval by national bodies of ISO and IEC.
Introduction
This Technical Report defines a collection of types that are intended to enhance the common language nature of the CLI, by facilitating language inter-operation. The collection includes generic tuples, functions, actions, optional value representation, a type that can contain a value of one of two different types, and a utility filler type.
These types are experimental and will be considered for inclusion in a future version of the CLI International Standard. A reference implementation, written in C#, is included (see the accompanying file CommonGenericsLibrary.cs). This implementation source is also available from http://kahu.zoot.net.nz/ecma . A binary version is also available from that site, along with any updates to the proposal.
Feedback on these types is encouraged. (Please send comments to ecmacli@zoot.net.nz.)
1 Scope
The CLI standard libraries (ISO/IEC 23271) provide a collection of common types that can be used by multiple languages. With the addition of generics to the CLI, the standard libraries have been extended to include a number of common generic types, in particular, collections. However, at present, these libraries do not include many simple generic types found in a number of different languages. Any language which uses these common types must implement them rather than deferring to the CLI library, thereby reducing language inter-operability. This Technical Report addresses this issue by providing a number of these common types.
Generic tuples (product types) are standard in a number of languages: C++ (template Pair), Ada, Haskell, and Standard ML (SML). However, languages differ in the number of pre-defined tuple sizes supported by their standard libraries; e.g. C++ provides just one (Pair) while Haskell provides eight (sizes 2 to 9) and SML allows any size of tuple. This Technical Report provides nine (sizes 2 to 10).
Generic programming encourages “higher order” programming where generic functions (methods) take function (delegate) type arguments that have generic types. Examples include Ada’s with and generic constraints, and function arguments in Haskell and SML. In the CLI, function values are provided in the form of delegates, so this proposal defines standard generic delegate types for functions (which return a value) and procedures (which do not).
Another two types that occur in a number of languages are an optional type, which either contains a value of some other type or an indication that such a value is not present; and an either type, which holds a value of one of two possible types and an indication of which one is present. This proposal provides both of these.
Note The optional type is similar to, but different from, the type System.Nullable.
Finally, in existing generic languages, a need has been found for a filler type to be used when a particular generic parameter is not required for a particular use of the generic type. A standard one-value type is often provided for this purpose, often called UnitorVoid. This Technical Report includes such a type.