Object ancestor := method (
prototype := self proto
if (prototype != Obejct,
writeln ("Slots of ",
prototype type,
"\n------------------"
)
prototype slotNames foreach (slotName,
writeln (slotName)
)
writeln prototype ancestors
)
)
 unless := method (
(
call sender doMessage (
call message argAt(0)
)
)
ifFalse (
call sender doMessage (
call message argAt(1)
)
)
ifTrue (
call sender doMessage (
call message argAt(2)
)
)
)

 Animals.io

    Object ancestors := method (
prototype := self proto
if (prototype != Object,
writeln ("Slots of ",
prototype type,
"\n----------------"
)
prototype slotNames foreach (
slotName,
writeln (sloteName)
)
writeln prototype ancestors
)
) Animal := Object clone
Animal speak := method (
"ambiguous animal noise" println
)
Duck := Animal clone
Duck speak := method (
"quack" println
)
Duck walk := method (
"waddle" println
)
disco := Duck clone
disco ancestors

 

Io_Language的更多相关文章

随机推荐

  1. 《ArcGIS Engine+C#实例开发教程》第一讲桌面GIS应用程序框架的建立

    原文:<ArcGIS Engine+C#实例开发教程>第一讲桌面GIS应用程序框架的建立 摘要:本讲主要是使用MapControl.PageLayoutControl.ToolbarCon ...

  2. C#中的ODBC、OLEDB连接

      using System;using System.Collections.Generic;using System.Text;using System.Data.Odbc;using Syste ...

  3. 【HDOJ】1171 Big Event in HDU

    母函数,先要算搞清楚组合数可能的最大值.非常大.N种设备的最大VAL*最大数量. #include <stdio.h> #include <string.h> #define ...

  4. hadoop2.2编程:自定义hadoop map/reduce输入文件切割InputFormat

    hadoop会对原始输入文件进行文件切割,然后把每个split传入mapper程序中进行处理,FileInputFormat是所有以文件作为数据源的InputFormat实现的基类,FileInput ...

  5. 结构体dtype_t

    /* SQL data type struct */ typedef struct dtype_struct dtype_t; struct dtype_struct{ unsigned mtype: ...

  6. NOI2014 起床困难综合症

    3668: [Noi2014]起床困难综合症 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 225  Solved: 153[Submit][Stat ...

  7. 【转】 Java虚拟机内存的堆区(heap),栈区(stack)和静态区(static/method)

    JAVA的JVM的内存可分为3个区:堆(heap).栈(stack)和方法区(method) 堆区:1.存储的全部是对象,每个对象都包含一个与之对应的class的信息.(class的目的是得到操作指令 ...

  8. DataProvider 传递参数

    package roger.testng; import org.testng.annotations.DataProvider; import org.testng.annotations.Test ...

  9. 初学redux笔记,及一个最简单的redux实例

    categories: 笔记 tags: react redux 前端框架 把初学redux的一些笔记写了下来 分享一个入学redux很合适的demo, 用redux实现计数器 这是从阮一峰老师git ...

  10. Clean Code – Chapter 4: Comments

    “Don’t comment bad code—rewrite it.”——Brian W.Kernighan and P.J.Plaugher The proper use of comments ...