News for hackers. Stuff that matters.
Re:Update on await syntax in Rust by ulucs on Tuesday May 28, 2019 @12:50PM (#20031907)
I think you can skip the empty () in D. The syntax becomes much more readable when you don't have to return to upper levels of functions. Thankfully pipes exist in functional languages, which makes it feel just right

    half_square =
      a
      |> square
      |> divide(_, 2)
Re:Update on await syntax in Rust by anchpop on Tuesday May 28, 2019 @01:15PM (#20032140)
I left the `()` because in some imperative languages there's a difference between `() -> a` and `a`, which makes `a.b` and `a.b()` different. In Haskell there's `>>>` and `&` in base, which I use all the time for this sort of workflow:

    find_half_square = square >>> (flip divide) 2 
This creates a function which takes a value, performs `square`, then performs `(flip divide) 2`. It's written in pointfree style, which means the function's input is never written in the definition of the function, which I find to be extremely aesthetically pleasing (as it allows me to focus on the composition of functions, without thinking about passing arguments around). This is one situation where changes in syntax allow you to reason about programs quite differently.
Re:Update on await syntax in Rust by uryga on Tuesday May 28, 2019 @03:11PM (#20033319)
"(flip divide) 2" can also be written as "(`divide` 2)" – i saw that idiom recently and i'm warming up to it!
Re:Update on await syntax in Rust by tracker1 on Tuesday May 28, 2019 @01:09PM (#20032079)
Was going to mention pipes... which imho is about the nicest syntax imho in terms of being able to follow workflow.