summaryrefslogtreecommitdiff
path: root/io/animals.io
diff options
context:
space:
mode:
Diffstat (limited to 'io/animals.io')
-rw-r--r--io/animals.io19
1 files changed, 19 insertions, 0 deletions
diff --git a/io/animals.io b/io/animals.io
new file mode 100644
index 0000000..b1b1a55
--- /dev/null
+++ b/io/animals.io
@@ -0,0 +1,19 @@
+Object ancestors := method(
+ prototype := self proto
+ if (prototype != Object) then (
+ writeln("Slots of ", prototype type, "\n-------------")
+ prototype slotNames foreach(slotName, slotName println)
+ 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