Is it possible to use Ruby to design a discrete event simulator using
coroutines? I’m looking for something like the generators in Python 2.2, is
there something like this in Ruby? The callcc method seems far too
expensive (looks like each one is about 14-15k in Windows XP), and the yield
method seems to return only to a passed in code block, not back to the
caller (I think, I’m new to Ruby).
Thanks,
Ken
How about
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/34953
Gotoken
···
At Sun, 6 Oct 2002 13:10:20 +0900, Ken Sprague wrote:
Is it possible to use Ruby to design a discrete event simulator using
coroutines? I’m looking for something like the generators in Python 2.2, is
there something like this in Ruby? The callcc method seems far too
expensive (looks like each one is about 14-15k in Windows XP), and the yield
method seems to return only to a passed in code block, not back to the
caller (I think, I’m new to Ruby).
Hello Ken,
Sunday, October 06, 2002, 8:10:20 AM, you wrote:
Is it possible to use Ruby to design a discrete event simulator using
coroutines? I’m looking for something like the generators in Python 2.2, is
there something like this in Ruby? The callcc method seems far too
expensive (looks like each one is about 14-15k in Windows XP), and the yield
method seems to return only to a passed in code block, not back to the
caller (I think, I’m new to Ruby).
but there is very cheap threads (it is not native OS threads). of
course, with ability to do synchronization. and even coroutines.rb on
yaraa which gives an example of emulating coroutines via threads
···
–
Best regards,
Bulat mailto:bulatz@integ.ru
Thanks Gotoken. Unfortunately, these coroutines are based on Ruby threads,
which are too resource expensive for my use. I’m looking for an
implementation of coroutines which are little more than “global gotos”, so
that tens or even hundreds of thousands of them can be running at the same
time.
Ken
Hmmm, I think that coroutines can be implemented with only theads
or continuations in Ruby. So, if you would like to go with Ruby,
- Is there any other way which doesn’t need coroutine?
- How about prototyping in ruby? And then write in a faster language.
Gotoken
···
At Sun, 6 Oct 2002 16:10:37 +0900, Ken Sprague wrote:
Thanks Gotoken. Unfortunately, these coroutines are based on Ruby threads,
which are too resource expensive for my use. I’m looking for an
implementation of coroutines which are little more than “global gotos”, so
that tens or even hundreds of thousands of them can be running at the same
time.
“Ken Sprague” wrote
…
Thanks Gotoken. Unfortunately, these coroutines are based on Ruby threads,
which are too resource expensive for my use. I’m looking for an
implementation of coroutines which are little more than “global gotos”, so
that tens or even hundreds of thousands of them can be running at the same
time.
How about using stackless Python?
/Christoph