DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Noé has posted 2 posts at DZone. View Full User Profile

Left To Right Affectation Operator In Io

12.26.2006
| 2249 views |
  • submit to reddit
        This simple line makes a simple left to right affectation operator in Io

-> := method( call sender setSlot(call argAt(0) name, self)) 
# Use :
2 -> a
3 -> b
a * b -> c
c println # => 6
# (thaks to jer) Note : This is quite broken
foo := Object clone
2 -> foo c 
foo c # raises an exception: "Number does not respond to c"
foo # => 2
# However, one can do :
foo do(2 -> c)