From: Stefan Rusterholz Date: 2007-08-19T06:57:50+09:00 Subject: Re: wishing of reactive programming in ruby ashishwave wrote: > ruby integrates power of functional programming from lisp , purest OO > from smalltalk, prototype oriented power from self etc etc into one > single language > > i just was wondering that whether the heavy developers/users of > reactive languages like kanaputs or reactive-C etc will ever get > reactive features in ruby. > > in kanaputs, If the variable 'c' is defined as c = a + b; and if the > reactivity of 'c' is set (c.reactive = true;), then each time the > value of 'a' or 'b' changes then the value of 'c' is updated as the > result of the addition > > > bye :-) > Ashish > ashishwave@yahoo.com. Not the same, probably rather slow, but hey: class Expression < BlankSlate def initialize(&expression) @expression = expression end def method_missing(*a, &b) @expression.call.send(*a, &b) end end a = 1 b = 2 c = Expression.new { a + b } c + 3 # => 6 a = 5 c + 3 # => 10 Have fun ;-) Regards Stefan -- Posted via http://www.ruby-forum.com/.