from Hacker News

Things you can’t do in Rust: destructure function arguments in declaration

by andrew-lucker on 12/7/17, 9:23 PM with 2 comments

  • by arh68 on 12/7/17, 9:38 PM

    > shorthand for a function with only a pattern as its body.

    Only an expression as its body seems more like it.

    Just to be clear, would you require the last function clause to be a catch-all/wildcard pattern? Or could you just define a function on 0 & 1? Separate question: would you want to be able to add a new clause for your function f below main? It's okay to want either outcome, I'm just curious. Third question: would you want/accept a delimiter between a function's clauses like ; or | ?

    I like the idea. Especially if you can still refer to pattern-matched parameters by name, too.