You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, imagine that you submit something, and there might be errors as a result, during some period of time, for example – not more than 5s. More over, if error appear, it will be visible only 1 second, so the code like:
will be pretty not obvious in understanding...
It's not obvious from the name what is happening here, because the implementation will be not consistent to both
wait.until
until returns false on "not matched condition" but while will throw exception
in programming usually the while is considered an opposite to until in context of "bolean logic", so it would be consistent if while also returned false in case of "not matched"
wait.for (throwing exception in case of falsy/not-matched) result)
for throws exceptioin as soon as condition not matched, but while throws exception as soon as condition is not matched but just during specific time set
the inconsistency here is in "waiting at most, trying to wait less" vs "waiting all the time long"
or am I wrong in the latter? Regardless of being inconsistent in context of technical implementation of for vs while vs until, isn't it consistent with common sense in context of "native English"?
Let's wait at most 5 min for hime to appear
here we naturally mean that as soon as he comes during period of 5 min - we go togather where we want, otherwise we for example call him and shout with "Exception/Error" ;)
Let's wait (and play) during 5 min while mother is not coming (to make us do homework)
here we kind of naturally wait for what we want...
but yet we change the previous behaviour of waiting... we wait during not at most
how to "override" this "at most" logic? I mean how to override it in context of "naming style"?
By the way, from the last example, probably it would be even more natural to say: Let's wait during 5 min unless mother comes (to make us do homework)... Hm... what about this style then:
yet we are allowed to call atMost on wait, should we remove it then?
but is it really so bad? :) maybe we can live with this .wait.atMost(5).unless(be.visible) ? what a native english speakeer would tell?
or maybe... should we allow both? like make the waiting algorithm to count both "at most timeout" and "during interval"? How this algorithm may look like then?
...
one more question... Won't unless confuse a bit when comparing to until? :)
This is probably something the simplest that we might implement, and it will be useful regardles of the future of while/unless/etc inside wait...
But is it really simple in context of implementing this "general condition" logic. Will it be easy to override wait's timeout with our "during" timeout from condition? Let's see...
The text was updated successfully, but these errors were encountered:
So, imagine that you submit something, and there might be errors as a result, during some period of time, for example – not more than 5s. More over, if error appear, it will be visible only 1 second, so the code like:
will not work!
So what to do?
currently we can do something like the following to achieve the goal:
or
or
do we need something more kind of user-friendly?
this:
will be pretty not obvious in understanding...
It's not obvious from the name what is happening here, because the implementation will be not consistent to both
until
returns false on "not matched condition" butwhile
will throw exceptionwhile
is considered an opposite tountil
in context of "bolean logic", so it would be consistent ifwhile
also returned false in case of "not matched"for
throws exceptioin as soon as condition not matched, butwhile
throws exception as soon as condition is not matched but just during specific time setor am I wrong in the latter? Regardless of being inconsistent in context of technical implementation of
for
vswhile
vsuntil
, isn't it consistent with common sense in context of "native English"?for
hime to appearwhile
mother is not coming (to make us do homework)By the way, from the last example, probably it would be even more natural to say: Let's wait during 5 min
unless
mother comes (to make us do homework)... Hm... what about this style then:note that this is not relevant because atMost interfere by meaning with "during" or "internal/timeout"
yet we are allowed to call atMost on wait, should we remove it then?
but is it really so bad? :) maybe we can live with this
.wait.atMost(5).unless(be.visible)
? what a native english speakeer would tell?or maybe... should we allow both? like make the waiting algorithm to count both "at most timeout" and "during interval"? How this algorithm may look like then?
...
one more question... Won't
unless
confuse a bit when comparing tountil
? :)And... One more idea, what about this:
?
This is probably something the simplest that we might implement, and it will be useful regardles of the future of while/unless/etc inside wait...
But is it really simple in context of implementing this "general condition" logic. Will it be easy to override wait's timeout with our "during" timeout from condition? Let's see...
The text was updated successfully, but these errors were encountered: