-
Notifications
You must be signed in to change notification settings - Fork 4
/
935.txt
122 lines (83 loc) · 6.11 KB
/
935.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
* 仕様書
[REFS[
- [1] [CITE[Web IDL (Second Edition)]] ([TIME[2014-02-10 21:45:38 +09:00]] 版) <http://heycam.github.io/webidl/#dfn-inherit>
- [26] [CITE[Web IDL (Second Edition)]] ([TIME[2014-02-10 21:45:38 +09:00]] 版) <http://heycam.github.io/webidl/#dfn-inherit-exception>
- [12] [CITE[Web IDL (Second Edition)]] ([TIME[2014-02-10 21:45:38 +09:00]] 版) <http://heycam.github.io/webidl/#dfn-inherit-dictionary>
]REFS]
* 構文
[2] [[インターフェイス]]の[[継承]]は、
[PRE(IDL example code)[
interface [VAR[derived-interface]] : [VAR[inherited-interface]] {
...
};
]PRE]
... のように表します [SRC[>>1]]。
[13] [[辞書]]の[[継承]]は、
[PRE(IDL example code)[
dictionary [VAR[derived-dict]] : [VAR[inherited-dict]] {
...
};
]PRE]
... のように表します [SRC[>>12]]。
[HISTORY[
[27] [[例外]]の[[継承]]は、
[PRE(IDL example code)[
exception [VAR[derived-exception]] : [VAR[inherited-exception]] {
...
};
]PRE]
... のように表します [SRC[>>26]]。
]HISTORY]
* インターフェイスの継承
[3] ある[[インターフェイス]]が別の[[インターフェイス]]から[DFN[[RUBYB[[[継承]]]@en[inherit]]]]する場合、
前者に対して後者のことを[RUBYB[[[被継承インターフェイス]]]@en[inherited interface]]、
後者に対して前者のことを[RUBYB[[[派生インターフェイス]]]@en[derived interface]]といいます [SRC[>>1]]。
[15] [[インターフェイス]]が[[継承]]するのは[[インターフェイス]]でなければなりません。
[11] [[インターフェイス]]には通常の[[インターフェイス]]と[[コールバックインターフェイス]]がありますが、
[[継承]]関係にある2つの[[インターフェイス]]は同じ種類で[['''なければなりません''']]。
[5] ある[[インターフェイス]]が直接または間接に[[継承]]する[[インターフェイス]]の[[集合]]を[DFN[[RUBYB[[[被継承インターフェイス群]]]@en[inherited interfaces]]]]といいます
[SRC[>>1]]。
;; [6] 当該[[インターフェイス]]自身は、[[被継承インターフェイス]]ではありません。
[7] [[被継承インターフェイス群]]に当該[[インターフェイス]]自身が含まれていては[['''なりません''']]
([[循環]]するような[[継承]]はできません) [SRC[>>1]]。
[4] ある[[インターフェイス]]を[[実装]]する[[オブジェクト]]は、その[[被継承インターフェイス]]も[[実装]]することになります。 [SRC[>>1]]
[9] [[多重継承]]はできません [SRC[>>1]]。
;; [8] ちなみにある[[オブジェクト]]が[[実装]]できるのは、特定の[[インターフェイス]]だけです
[SRC[>>1]]。
;; [10] ただし [CODE(IDL)@en[[[implements]]]] によって事実上の[[多重継承]]は実現できます。
[36] [[被継承インターフェイス]]を持つ[[インターフェイス]]には [CODE(IDL)@en[[[ArrayClass]]]]
[[拡張属性]]や [CODE(IDL)@en[[[MapClass]]]] [[拡張属性]]を指定できません。
* 辞書の継承
[14] ある[[辞書]]が別の[[辞書]]から[DFN[[RUBYB[[[継承]]]@en[inherit]]]]する場合、
前者に対して後者のことを[RUBYB[[[被継承辞書]]]@en[inherited dictionary]]、
後者に対して前者のことを[RUBYB[[[派生辞書]]]@en[derived dictionary]]といいます [SRC[>>12]]。
[16] [[辞書]]が[[継承]]するのは[[辞書]]でなければなりません [SRC[>>12]]。
[17] ある[[辞書]]が直接または間接に[[継承]]する[[辞書]]の[[集合]]を[DFN[[RUBYB[[[被継承辞書群]]]@en[inherited dictionaries]]]]といいます
[SRC[>>12]]。
;; [18] 当該[[辞書]]自身は、[[被継承辞書]]ではありません。
[19] [[被継承辞書群]]に当該[[辞書]]自身が含まれていては[['''なりません''']]
([[循環]]するような[[継承]]はできません) [SRC[>>12]]。
[20] [[辞書値]] ([[辞書]]の[[実現値]]) は、[[辞書]]とその[[被継承辞書]]の[[メンバー]]に対応するキーと値の組を持つことができます
[SRC[>>12]]。
[21] [[被継承辞書]]の[[メンバー]]のことは[RUBYB[[[被継承メンバー]]]@en[inherited member]]
[SRC[>>12]] と呼ばれています。
[24] [[辞書メンバー]]の名前は、[[被継承メンバー]]のものと衝突してはなりません [SRC[>>12]]。
;; [25] [[インターフェイス]]とは違って[[辞書]]の[[メンバー]]は[[上書き]]できません。
[22] [[辞書メンバー]]は、その所属する[[辞書]]や[[被継承辞書]]、
あるいは[[メンバー]]または[[被継承メンバー]]が所属[[辞書]]を[[型]]として含むような[[辞書]]を[[型]]としてはなりません
[SRC[>>12]]。
[23] [[辞書]]における[[辞書メンバー]]の[[順序]]は、[[被継承メンバー]]の後にそれ以外の[[メンバー]]とされています
[SRC[>>12]]。
* 歴史
** 例外の継承
[28] ある[[例外]]が別の[[例外]]から[DFN[[RUBYB[[[継承]]]@en[inherit]]]]する場合、
前者に対して後者のことを[RUBYB[[[被継承例外]]]@en[inherited exception]]、
後者に対して前者のことを[RUBYB[[[派生例外]]]@en[derived exception]]といいます [SRC[>>26]]。
[29] [[例外]]が[[継承]]するのは[[例外]]でなければなりません [SRC[>>26]]。
[30] ある[[例外]]が直接または間接に[[継承]]する[[例外]]の[[集合]]を[DFN[[RUBYB[[[被継承例外群]]]@en[inherited exceptions]]]]といいます。
;; [31] 当該[[例外]]自身は、[[被継承例外]]ではありません。
[32] [[被継承例外群]]に当該[[例外]]自身が含まれていては[['''なりません''']]
([[循環]]するような[[継承]]はできません) [SRC[>>26]]。
[33] ある[[例外]]を[[実装]]する[[オブジェクト]]は、その[[被継承例外]]も[[実装]]することになります。 [SRC[>>26]]
[34] [[多重継承]]はできません [SRC[>>26]]。
;; [35] 現実に[[例外]]の[[継承]]が利用された例はありません。