多重継承とは(修正)

多重継承

You can add any number of protos to an object's protos list. When responding to a message, the lookup mechanism does a depth first search of the proto chain.
Io プログラミングガイド - オブジェクト - 多重継承

多重継承

あるオブジェクトのprotosリストには、protoを幾つでも追加できます。メッセージへの応答の際、検査構造は1層目のprotoチェーンからprotoチェーンを深さ優先で検査します。

やってみた

ObjectのappendProtoで、Protosリストに追加していく。問い合わせに対して追加した順に検査される。

A := Object clone do (
    a := "a of A"
)

B := Object clone do (
    a := "a of B"
    b := "b of B"
)

C := Object clone do (
    b := "b of C"
    c := "c of C"
)

hoge := A clone appendProto(B) appendProto(C)
hoge a println //prints "a of A"
hoge b println //prints "b of B"
hoge c println //prints "c of C"

fuga := A clone appendProto(C) appendProto(B)
fuga b println //prints "b of C"

AA := A clone do(
    b := "b of AA"
)

foo := AA clone appendProto(B)
foo b println //prints "b of AA"

修正

depth first = 深さ優先。
pythonドキュメントより。