1. 对1+1求值,然后对1+'one'求值。Io是强类型还是弱类型,用代码证实
<span style="font-family:SimSun;font-size:14px;">1 + "one"
Exception: argument 0 to method '+' must be a Number, not a 'Sequence'
---------
message '+' in 'Command Line' on line 1</span>
<span style="font-family:SimSun;font-size:14px;">Car := Object clone
Plane := Object clone
Plane := Car clone
Plane type</span>
Io是是强类型2. 0是true还是false,空字符串,nil分别是什么?
true and 0 ==> true
true and "" ==> true
true and nil ==> false
3. 如何知道某个原型都支持哪些槽?
<span style="font-family:SimSun;font-size:14px;">Car slotNames
Car proto <span style="white-space:pre"> </span>// 父类的槽</span>
4. =、 :=、 ::=之间有什么区别?会在什么情况下使用它们?
= 赋值 // 不存在会报错
:= 赋值 // 不存在则创建,clone的类type为自己,相当于复制后继承
::= 赋值 // 不存在则创建,clone的类type为原型,相当于复制别名对象
5. 给定槽名称,执行该槽中代码
<span style="font-family:SimSun;font-size:14px;">Car fly := method("i can fly" println)
Car fly
Car getSlot("fly")</span>