New iteration over the ev++ improvement patch.

Marc Lehmann schmorp at schmorp.de
Mon Jan 28 12:20:31 CET 2008


On Fri, Jan 25, 2008 at 01:04:24PM -0200, Leandro Lucarella <llucax at gmail.com> wrote:
> > Can you explain how you would do the same with just an ev_loop pointer
> > (i.e. how do you initialise it?)? I don't think it can be done, so I claim
> > they are not at all the same.
> 
> You can't initialize it with the static anonymous struct either! You have
> to provide a function to initialize the loop.

But yes, in C++ you can, by providing a cast operator :)

I guess thats too convoluted for you, if you didn't see it int eh frist
place, so itmight be a baaad idea :)

> Maybe I'm not understanding what you are proposing. Can you implement it
> (I'm sure I wont take you more than 10 minutes) and send me the patch so I
> can take a look at exactly what you have in your mind. An example of usage
> will be helpful too.


  static struct {
    operator loop_ref () { return get_default_loop (); }
  } defaultloop;

     ...
     ev::loop_ref l = ev::defaultloop;

this works with cvs.

it might be too weird, but if i had the option, I had used the same
approach with the C interface. and the watchars kind of already call an
init function eaxh time you rely on the no loop = default loop default
argument, so it would kind of be in the same spirit as the remaining interface.

Maybe it all boils down to documentation.

I'd personally not call any functions (the call isn't what hurts me, its
the amount of code generated).

So, now you cna decide :)

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list