On 03/06/16 20:17, Cedric BAIL wrote: <snip> >>> also promises should become eo objects with event cb's >>> so they work just like everything else. i can ref, unref, delete and >>> whatever >>> them like everything else. > > As said above, this does work. Example with event : > eo_promise = efl_file_set(image, "toto.jpg", NULL); > eo_event_callback_array_add(eo_promise, promise_callbacks1(), NULL); > eo_event_callback_array_add(eo_promise, promise_callbacks2(), NULL); > > In this 3 lines, there is already 2 case in which that fail. First if, > the object is done before the callback is set, data are lost and there > is no way to get any event. Ofcourse, we can override the behavior of > events on this eo_promise completely. Now let's imagine, that we > actually do always store the events, so that everytime someone > register a callback we can send the event. Still you can't auto del > the object at any point in time, you have to force the user to > implement the eo_del and to always provide both a then and cancel > callback. > > Other possibility, it is an event on the object itself. > eo_event_callback_array_add(image, promise_callbacks1(), NULL); > efl_file_set(image, "toto.jpg", NULL); > eo_event_callback_array_add(image, promise_callbacks2(), NULL); > > Same again, this can not work. The first group of event handler, > promise_callbacks1(), may actually be triggered by a previously > running promise on the object, so you have to first forcefully stop > the previous operation. This would add complexity. And still the > second callback has the same issue as the previous case, if it is a > normal eo event, it could have been triggered before any callback get > registered and the event be lost... Same story short, doesn't work. >
I'm currently reading through the thread, and I didn't see anything mentioned about this other than a casual remark you made, so just wanted to make it crystal clear regarding implementing it as an Eo object. The whole point/magic of inheritance is that you can and are supposed to override functions if needed. Overriding callback add to call the callback immediately upon addition (if already done) is how I would implement promise callbacks. It's clean, easy and as intended. This is definitely not a problem. <snip> -- Tom. ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohomanageengine _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel