News for hackers. Stuff that matters.
Re:The Ultimate Conditional Syntax by andyferris on Sunday October 20, 2024 @10:17PM (#41900153)
The other one I want occassionally is "or".

Imagine Left and Right contained data of compatible types, then I'd like to extract that data (regardless of tag) like so:

    if x is Left(y) or x is Right(y) then ...
That way I only need to write the `...` part once. (This could be combined with the rest of the pattern matching machinery in interesting ways, and would probably need to have eager matching / short-circuiting semantics in case both cases match).
Re:The Ultimate Conditional Syntax by lptk on Sunday October 20, 2024 @10:51PM (#41900262)
We definitely want to get into that! Unfortunately it's not completely straightforward. A simple desugaring doesn't work due to our support for intermediate bindings and computations, which we don't want to recompute.
Re:The Ultimate Conditional Syntax by HelloNurse on Monday October 21, 2024 @11:16AM (#41905096)
Do you mean something like compiling

  if (x is Left(Foo(y)) or x is Right(Foo(y))) and (y<5 or z>2) then 5
and destructuring Foo(y) only one time and dealing with parentheses?