On March 22, 2018 9:22 AM, Carsten Haitzler <ras...@rasterman.com> wrote:
> On Thu, 22 Mar 2018 09:56:37 +0100 Jérémy Zurcher jer...@asynk.ch said:
> > just trying to follow here and maybe clarify a bit.
> > 
> > Of course everybody here knows about the conventions :
> > 
> > -   0 is the success return code
> > -   anything else is an (hopefully documented) error
> > 
> > we all know about logical shell chaining :
> > 
> > cmd1 && cmd2 && cmd3 || cmd4
> > 
> > but what I think I understood here is that promises chaining should be a
> > different construction where the chaining is not dependent on the return 
> > code
> > (success/failure) of any of the actions.
> > 
> > { action 1 } then { action 2 } then { action 3 }
> > 
> > it's a 'then' meaning 'after that', not an '&&' that means 'on action 
> > success'
> 
> actually then is on success. if the promise rejects (as a failure) it won't be
> a "then" chain that continues. that's key to promises. then here is then IF 
> the
> promise succeeds without failure.

What are you talking about ??? There is only one callback and you get an 
Eina_Value that will be an Eina_Error in case of a rejected promise and 
something else if it was a success. The code inside the then has to decide what 
to do in all case.

> see eio efl_io_managr.c - if stat fails on a file it rejects the promise with 
> an error.
> it's doing that and that is apparently correct, but an exit error code is not 
> correct
> doing the same thing.

Is an exit code a system failure ? Is an exit code something you can do 
something with ? Which exit code value mean ENOENT ?
 
> > so with v beeing the value of the promise, you do
> > 
> > { action 1 } then { if (v!=0) return action21 else return action22 } then
> > { if (v==0) action 3 }
> > 
> > and with handy helpers (operator logic) like
> > 
> > bypassOnFailure(if (v!=0) return v)
> > bypassOnSuccess(if (v==0) return v)
> > 
> > you can do
> > 
> > { action1 } then { bypassOnFailure(); action2 } then { bypassOnSuccess();
> > 
> > action3 } then { byPassOnFailure; action4 }
> > 
> > the chaining fails on "System errors" -> Exception on some languages
> > the logic is implemented in the futur
> > 
> > hope I'm not in outer space.
> 
> see efl_io_manager.c - if a stat() of a file fails (e.g. file doesn't exist),
> the promise rejects with a error. i simply did precisely the same thing with 
> an
> exit code of non-zero. it's an error/failure (that was my point in indicating
> it is in shell examples). thus it should behave the same way. not doing so is
> inconsistent.

man 1 stat vs man 2 stat

Does the first one define any return value in case of error ? Does the second 
one ? This are not the same things. They do not have the same documented 
behavior. There is consistency between what you are comparing in the first 
place.

Cedric

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to