/
994.txt
163 lines (136 loc) · 5.89 KB
/
994.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
[1] [[Web IDL]]/[[DOM]] の[DFN[[RUBYB[[[型]]]@en[type]]]]の一覧です。
* 仕様書
[REFS[
- [3] [CITE[Web IDL (Second Edition)]] ([TIME[2014-02-10 21:45:38 +09:00]] 版) <http://heycam.github.io/webidl/#idl-types>
]REFS]
* WebIDL 基本的な型
[FIG(short list)[
- [CODE(DOMi)@en[[[any]]]]
- [CODE(DOMi)@en[[[byte]]]]
- [CODE(DOMi)@en[[[octet]]]]
- [CODE(DOMi)@en[[[boolean]]]]
- [CODE(DOMi)@en[[[short]]]]
- [CODE(DOMi)@en[[[unsigned short]]]]
- [CODE(DOMi)@en[[[long]]]]
- [CODE(DOMi)@en[[[unsigned long]]]]
- [CODE(DOMi)@en[[[long long]]]]
- [CODE(DOMi)@en[[[unsigned long]]]]
- [CODE(DOMi)@en[[[float]]]]
- [CODE(DOMi)@en[[[unrestricted float]]]]
- [CODE(DOMi)@en[[[double]]]]
- [CODE(DOMi)@en[[[unrestricted double]]]]
- [CODE(DOMi)@en[[[DOMString]]]]
- [CODE(DOMi)@en[[[USVString]]]]
- [CODE(DOMi)@en[[[ByteString]]]]
- [CODE(DOMi)@en[[[object]]]]
- [CODE(DOMi)@en[[[Date]]]]
- [CODE(DOMi)@en[[[RegExp]]]]
- [CODE(DOMi)@en[[[Function]]]]
- [CODE(DOMi)@en[[[Int8Array]]]]
- [CODE(DOMi)@en[[[Int16Array]]]]
- [CODE(DOMi)@en[[[Int32Array]]]]
- [CODE(DOMi)@en[[[Uint8Array]]]]
- [CODE(DOMi)@en[[[Uint16Array]]]]
- [CODE(DOMi)@en[[[Uint32Array]]]]
- [CODE(DOMi)@en[[[Uint8ClampedArray]]]]
- [CODE(DOMi)@en[[[Float32Array]]]]
- [CODE(DOMi)@en[[[Float64Array]]]]
- [CODE(DOMi)@en[[[ArrayBuffer]]]]
- [CODE(DOMi)@en[[[DataView]]]]
- [CODE(DOMi)@en[[[Error]]]]
- [CODE(DOMi)@en[[[DOMException]]]]
]FIG]
* IDL 素片により定義される型
[FIG(short list)[
- [CODE(DOMi)@en[[[interface]]]]
- [CODE(DOMi)@en[[[dictionary]]]]
- [CODE(DOMi)@en[[[enum]]]]
- [CODE(DOMi)@en[[[callback]]]]
]FIG]
* 組み合わせの型
[FIG(short list)[
- [CODE(DOMi)@en[[[?]]]]
- [CODE(DOMi)@en[[[sequence<>]]]]
- [CODE(DOMi)@en[[['''['''''']''']]]]
- [CODE(DOMi)@en[[[union]]]]
- [CODE(IDL)@en[[[Promise<>]]]]
]FIG]
* 型定義されている型
[FIG(short list)[
- [CODE(DOMi)@en[[[ArrayBufferView]]]]
- [CODE(DOMi)@en[[[BufferSource]]]]
- [CODE(DOMi)@en[[[EventHandler]]]]
- [CODE(DOMi)@en[[[Function]]]]
- [CODE(DOMi)@en[[[VoidFunction]]]]
- [CODE(DOMi)@en[[[DOMTimeStamp]]]]
- [CODE(DOMi)@en[[[DOMHiResTimeStamp]]]]
- [CODE(DOMi)@en[[[VibratePattern]]]]
]FIG]
* 歴史的な型
[FIG(short list)[
- [CODE(DOMi)@en[[[exception]]]]
- [CODE(DOMi)@en[[[ScalarValueString]]]]
- [CODE(DOMi)@en[[[ArrayBufferData]]]]
- DOM3 Core
-- [CODE(DOMi)@en[[[DOMObject]]]]
-- [CODE(DOMi)@en[[[DOMUserData]]]]
- DOM LS
-- [CODE(DOMi)@en[[[LSInputStream]]]]
-- [CODE(DOMi)@en[[[LSOutputStream]]]]
-- [CODE(DOMi)@en[[[LSReader]]]]
-- [CODE(DOMi)@en[[[LSWriter]]]]
- XML Schema API
-- [CODE(DOMi)@en[[[GenericString]]]]
-- [CODE(DOMi)@en[[[GenericObject]]]]
-- @@ XXX
- WebCGM DOM
-- [CODE(DOMi)@en[[[WebCGMString]]]]
]FIG]
* 分類
[4] [[Web IDL]] では次のような分類が定義されています [SRC[>>3]]。
[FIG(short list)[
- [[整数型]]
- [[数値型]]
- [[文字列型]]
- [[primitive型]]
- [[型付き配列型]]
- [[バッファー源型]]
- [[オブジェクト型]]
]FIG]
* 識別子
[5] [[Web IDL]] 上では、組み込みの型は予約語 (の組み合わせ) により、
[[IDL素片]]により定義される型は[[識別子]]により、
組み合わせの型はそれらと [[Web IDL]] の構文の組み合わせによって表現されます。
[6] それぞれの[[型]]に対しては[[型名]]が定義されています [SRC[>>3]]。
ただし[[型名]]は衝突することがありますから、[[型]]を識別する目的では使えません。
* 型に関する概念
[7] [CODE(IDL)@en[[[any]]]] や[[union型]]において実際の値の[[型]]のことを、
[[特定型]]といいます。
[13] [[配列型]]や[[列型]]において構成要素の[[型]]のことを、[[要素型]]といいます。
[9] [[union型]]を構成する[[型]]を[[メンバー型]]といいます。
[8] [[null可能型]]に対して元の[[型]]のことを[[内側型]]といいます。
* 型指定の制約
[12] [[型]]は、指定されてる対象によって、次のような制約があります。
[FIG[
, ,[CODE(IDL)@en[[[any]]]],[[primitive型]],[CODE(IDL)@en[[[object]]]],[[インターフェイス]],[[辞書]],[[列挙]],[[コールバック関数]],[CODE(IDL)@en[[[Date]]]],[CODE(IDL)@en[[[RegExp]]]],[CODE(IDL)@en[[[void]]]]
,[[定数]]の[[型]],×,○?t,×,×,×,×,×,×,×
,[[属性]]の[[型]],○?tau,○?tau,○?tau,○?tau,×,○?tau,○?tau,○?tau,○?tau
,[[返し型]],○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○
,[[引数]]の[[型]],○?taus,○?taus,○?taus,○?taus,○taus,○?taus,○?taus,○?taus,○?taus
,[[辞書メンバー]]の[[型]],○?taus,○?taus,○?taus,○?taus,※taus,○?taus,○?taus,○?taus,○?taus
,[[例外フィールド]]の[[型]],○?tau,○?tau,○?tau,○?tau,×,○?tau,○?tau,○?tau,○?tau
,[[直列化可能型]],×,○?tus,×,※?tus,※?tus,○?tus,×,○?tus,×
,[CODE(IDL)@en[[[typedef]]]] の[[型]],○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus
,[[union]]の[[メンバー型]],×,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus
,[[null可能型]]の[[内側型]],×,○taus,○taus,○taus,○taus,○taus,○taus,○taus,○taus
,[CODE(IDL)@en[[[sequence<>]]]] の[[内側型]],○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus
,[[配列]]の[[内側型]],○?tau,○?tau,○?tau,○?tau,×,○?tau,○?tau,○?tau,○?tau
,[CODE(IDL)@en[[[Promise]]]] の[[内側型]],○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○?taus,○
- ?・・・[[null可能型]]も可能
- t・・・[CODE(IDL)[[[typdef]]]] も可能
- a・・・[[配列]]も可能
- u・・・[[union]]も可能
- s・・・[CODE(IDL)@en[[[sequence]]]] も可能
]FIG]
* 関連
[2] [[DOMインターフェイスの一覧]]もあります。