Io chokes on sample code
Duke Normandin <[email protected]> Sat, 25 Feb 2012 22:13:02 -0700
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <20120225221302.1243c84d@select-man> |
io
Io 20110905
Io> Account := Object clone do(
... balance := 0.0
... deposit := method(v, balance = balance + v)
... withdraw := method(v, balance = balance - v)
... show := method(writeln("Account balance: $", balance))
... )
==> Account_0x866af20:
balance = method(...)
type = "Account"
Io> myAccount := Account clone
==> Account_0x867a010:
Io> myAccount show
Exception: Account does not respond to 'show'
---------
Account show Command Line 1
Why the error?
Does it have something to do with the do( ) construct?
The example I use is from:
http://www.iolanguage.com/about/samplecode/