[#7872] Nonblocking socket-connect — "Francis Cianfrocca" <garbagecat10@...>

All, I needed a nonblocking socket connect for my asynchronous-event

18 messages 2006/05/14
[#7873] Re: Nonblocking socket-connect — Tanaka Akira <akr@...17n.org> 2006/05/14

In article <3a94cf510605140559l7baa0205le341dac4f47d424b@mail.gmail.com>,

[#7874] Re: Nonblocking socket-connect — "Francis Cianfrocca" <garbagecat10@...> 2006/05/15

How about introducing the method Socket#set_nonblocking, or alternatively

[#7875] Re: Nonblocking socket-connect — Yukihiro Matsumoto <matz@...> 2006/05/15

Hi,

[#7876] Re: Nonblocking socket-connect — "Francis Cianfrocca" <garbagecat10@...> 2006/05/15

Well, it's ok then. I'm comfortable adding in the nonblocking

[#7877] Re: Nonblocking socket-connect — Yukihiro Matsumoto <matz@...> 2006/05/15

Hi,

[ ruby-Bugs-4341 ] Sather-like iterators

From: noreply@...
Date: 2006-05-03 02:28:26 UTC
List: ruby-core #7811
Bugs item #4341, was opened at 2006-05-03 05:28
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=4341&group_id=426

Category: Core
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Oren Ben-Kiki (oren)
Assigned to: Nobody (None)
Summary: Sather-like iterators

Initial Comment:
OK, not having these is obviously not a bug, it is the "lack of a feature". Still, just in case that someone says that the reason Ruby 2.0 or whatever doesn't have them is that people don't think it is important enough to ask for them... I'm asking for them. Also, this is one of the few things Python does better then Ruby, and we just can't have that, can we? :-)

The current implementation of Ruby iterators (using yield) actually lends itself to generalization into Sather-like iterators without changing the source code. For example:

  def ruby_iterator(args)
    some_loop_construct
      yield stuff
    end
  end

Old style iteration:

  ruby_iterator { |stuff| ... loop on a single sequence ... }

Sather-style iteration:

  loop
    stuff = &ruby_iterator # & indicates Sather iterator use, like
    other_stuff = &other_iterator # the & block... only outside-in.
    ... loop on two sequences ...
  end

Returning from either iterator methods would terminate the loop (like in Sather).

Yes, this means built-in support for true co-routines, which is *very* useful in practice for a host of problems which otherwise would require threads and all sort of nastiness.

I find it frustrating that Ruby _almost_ got this - the iterator sources are already written the right way, all it takes is "just" allowing them to be called outside-in instead of inside-out...

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=4341&group_id=426

In This Thread

Prev Next