Add and
and or
keywords
#532
Replies: 7 comments
-
+1 cause the current Another alternative is to have better formatting for |
Beta Was this translation helpful? Give feedback.
-
Can the compiler optimize list.and in these cases? |
Beta Was this translation helpful? Give feedback.
-
@waalge that's a bit more complicated to this at this stage because the compiler has no notion of stdlib whatsoever. That means you'd need some heuristic to first detect that this is one of the case, and then apply the optimisation. What @MicroProofs suggests is fairly straightforward as it can be done entirely as a syntactic sugar. That is, something that's fully handled by the parser / type checker; a shorthand to produce a more complicated AST. |
Beta Was this translation helpful? Give feedback.
-
I can only take your word for it on that - I have no grasp on the complexity of getting the compiler to recognize things like this pattern. I think adding new key words is a marginal increase on user cognitive load - there would be two things which look quite similar. And and or from I'm not in a position to provide a better fix. Chaining binops is also suboptimal. I use multiple |
Beta Was this translation helpful? Give feedback.
-
@waalge if this were to be a thing, I suspect we'd get rid of the list functions in stdlib. That said though, I think just having the formatting look good would do a lot here |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Think i might change my mind on this.
(I'm sure alternatives are available) |
Beta Was this translation helpful? Give feedback.
-
They could even have special prefixes but this would be really useful because it is common to have very long chains of booleans.
Vec<UntypedExpr>
Beta Was this translation helpful? Give feedback.
All reactions