Python vs. Io
Sean Ross
sross at connectmail.carleton.ca
Fri Jan 30 21:41:10 EST 2004
"Daniel Ehrenberg" <LittleDanEhren at yahoo.com> wrote in message
news:711c7390.0401301726.3e38da27 at posting.google.com...
[snip example]
> Does that illustrate it well? I know the difference between := and =
> is annoying, but you'll get used to it, and it allows really cool
> things to be done with scopes and inheretance.
I think I get the idea. Let's see:
P = Object clone do( # saw do() used in iolanguage mail archive
allocated = 0
init = method(
id := allocated # semi-colons required?
allocated += 1
)
howMany = method(return allocated)
)
x := P clone
y := P clone
write("allocated? ", P howMany())
# output ...
# allocated? 2
Correct?
Thanks for making me aware of this language, it has some
interesting ideas. I'm not annoyed by the difference between :=
and =. I understand the issue(s) they're trying to solve: you don't
need to declare local variables, or use self, explicitly. I don't have
a problem with that. I imagine it could lead to subtle bugs (if you
update a slot when you meant to set a new one), but that is only
speculation on my part.
I'm not a fan of the parenthesis (which might be expected from
a Python user - love that significant whitespace ;). I'm also not a
big fan of 'clone', I'd rather see 'new', but I do understand why
'clone' is more apt. Of course, in this language, you could always
just say
Object new = Object getSlot("clone")
P = Object new
...
I can appreciate the flexibility of that.
More information about the Python-list
mailing list