-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance the experience of programming with booleans and integers #13
Comments
@albertnetymk I think this could be another good ticket for you once @EliasC or @kaeluka has walked you through the other one. |
A question/comment is about short-circuiting: what are the semantics when we have asynchronous method calls? If The latter variant sounds most "parallel by default", but when considering side-effects, it could lead to surprising results. Consider for example the pattern
With the latter approach, this would start the sensitive computation regardless of the state of By the way, the current generated code does not short-circuit anything right now. Even
|
In your example if (get x.isConsistent()) and (get x.sensitiveComputation()) ... The call x.sensitiveComputation() will not be made until after the first get returns, if at all. (This is ABS semantics) |
I agree with this ABS semantics, which is more intuitive to me. BTW, what does ABS stands for? I can't find it by searching with The reason why the current boolean operator implementation doesn't take care of this short-circus is that we are translating It seems it's one overkill to me, for most |
ABS == "Abstract Behavioural Specification" @albertnetymk: This seems to be one of the/the first papers on ABs: http://link.springer.com/chapter/10.1007/978-3-642-25271-6_8 I haven't read it myself though. |
Great design questions!
I would favour this! It seems more in the spirit of Encore, and short-circuiting boolean operators was always a hack anyway. Or at least encouraged hacky programming. This would be less familiar than many mainstream languages, but at this point, that shouldn’t be a big concern. A possible design would be to "guarantee nothing”, i.e., executing
may run both This feels more in the spirit of Encore than going with (what I initially suggested). Fewer guarantees means more opportunities for static//dynamic optimisation. If the programmer wants a short-circuiting —Tobias |
Can someone make a decision on what to do here, document the choice in the spec (@kaeluka and @kikofernandez) and close this? |
My view (decision) is that this fine-grained parallelism is not what we are aiming for, so lets just use the usual semantics of |
Just a note to whoever is implementing this in the end. If we go with short-circuiting int tmp1 = 0;
int tmp2 = 0;
int tmp3 = ! (tmp2);
int tmp4 = (tmp1 && tmp3); The compiler probably needs to be made aware that it's translating a compound boolean expression and change the order in which it does the computations. This could work: int tmp4 = ( ({tmp1 = 0; tmp1}) && ({tmp2 = 0; tmp3 = ! (tmp2); tmp3})); |
@EliasC Is the current status that:
If so, please close this. @supercooldave — please open a separate ticket for that specific item. |
@TobiasWrigstad That's right! |
Add support for
Add support for negative integer literals
The text was updated successfully, but these errors were encountered: