paulk-asert opened a new pull request, #2853:
URL: https://github.com/apache/groovy/pull/2853

   …when(cond)
   
   Offer.when(BooleanSupplier) writes the precondition onto the branch it 
belongs to, as occam, Ada, Erlang and Kotlin do, instead of leaving the 
association to the position of a flag. It returns a guarded copy, so offers 
stay immutable and reusable, and guards conjoin — with each other and with the 
flags of select(boolean...).
   
   The condition is a supplier rather than a boolean because it is consulted 
once per select() call: that is what lets a guarded select be built once and 
reused as the state it guards on changes. A guarded-off offer is not registered 
on its channel and keeps its position, and a select with no enabled offer fails 
with IllegalStateException whether the offers were disabled by guard or by flag.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to