D
Daniel Nugent
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 =3D DataFlow.new
bar =3D Thread.new(foo) {|fooinarr| print fooinarr[0]}
baz =3D Thread.new(foo) {|fooinarr| sleep(3);fooinarr[0] =3D "Hello World,
sorry I'm late"}
Or, alternatively
foo =3D DataFlow.new
Thread.new(foo) {|fooinarr| begin(fooinarr[0]} #Starts a time
consuming, but autonomous job
#Lots of user interaction
foo =3D 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.
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 =3D DataFlow.new
bar =3D Thread.new(foo) {|fooinarr| print fooinarr[0]}
baz =3D Thread.new(foo) {|fooinarr| sleep(3);fooinarr[0] =3D "Hello World,
sorry I'm late"}
Or, alternatively
foo =3D DataFlow.new
Thread.new(foo) {|fooinarr| begin(fooinarr[0]} #Starts a time
consuming, but autonomous job
#Lots of user interaction
foo =3D 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.