Never been to DZone Snippets before?

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

Left to right affectation operator in Io (See related posts)

This simple line makes a simple left to right affectation operator in Io

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

You need to create an account or log in to post comments to this site.


Click here to browse all 5521 code snippets

Related Posts