From: Daniel Nugent Date: 2005-10-29T05:49:50+09:00 Subject: What would it take to change the behaviour of variable assignment? Hello, I've been considering the ways to add a particular language construct (data flow variables) to Ruby. I've come up with, and implemented, one method of doing this, but it relies on global variables (I mentioned this on the list a month ago or so), so it's not something I really want to stick with. Another way I've imagined doing it would involve changing the way assignment works for instances of a Class while behaving more nicely. I'm envisioning something like this: foo = DataFlow.new bar = Thread.new(foo) {|fooinarr| print fooinarr[0]} baz = Thread.new(foo) {|fooinarr| sleep(3);fooinarr[0] = "Hello World, sorry I'm late"} Or, alternatively foo = DataFlow.new Thread.new(foo) {|fooinarr| begin(fooinarr[0]} #Starts a time consuming, but autonomous job #Lots of user interaction foo = gets #Lots more interaction I know these examples aren't the greatest, but trust me, there's better stuff you can do. In any case, to make this possible, it would require changing the way that variabe assignment works. I realize that this isn't something you can do in pure Ruby, but I'm curious if anyone knows of a way to do it at all, possibly limiting the scope of the change to just members of DataFlow so that they can act as wrappers for objects assigned to foo. Feel free to berate me if this is an unrealistic expectation. -- -Dan Nugent