logoalt Hacker News

zamadatix • today at 3:18 AM • 0 replies • view on HN

It took me a second to find you were referencing section 2.8 https://vine.dev/docs/features/conditions

With that context, this example is a minimal example for explaining `and` short circuits and `&` does not. I.e. the `a < b < c is equivalent to (a < b) & (b < c)` is just explaining the logical behavior (with even more verbose equivilant logic after), not showing off how this particular example will parallelize better as part of introing the conditional operators behavior.

This exists to allow you to control whether parallel computation should happen or if it should resolve the first condition before wasting parallel compute to resolve the nth condition(s). E.g. imagine something like `isEven(x) & len(factor(x) > 2` vs `isEven(x) and len(factor(x) > 2` (but the functions can be a lot more complicated). Maybe you want to tell the compiler to short circuit and save average compute at the cost of total latency, maybe you want to tell the compiler to schedule both in parallel and get the better max latency at the cost of running more compute. Especially if you do vast numbers of such things as a workload vs just a few as a dependency.

I haven't read through the rest of everything to see if they have anything interesting compared to other parallel computation solutions, I just know this example isn't supposed to help answer that one way or the other.