News for hackers. Stuff that matters.
Re:Such a Little Thing: The Semicolon in Rust by lihaoyi on Thursday October 18, 2012 @06:04PM (#4671334)

    The downside is that you would have to put () (Rust's version of “nil”) in a bunch of functions to fulfil the requirements of the callback's signature since otherwise the type inferred from the function would be the value of the last expression
Wouldn't co/contra-variance solve this entirely? It works just fine in Scala for example

    scala> def runTwice(f: () => Unit) = {
         |  f()
         |  f()
         | }
    runTwice: (f: () => Unit)Unit

    scala> runTwice{ () =>
         |  println("moo")
         |  1
         | }
    moo
    moo
Note how it expects a function that returns Unit, i'm passing in a function that returns an Int (1), but the compiler is perfectly happy.
Re:Such a Little Thing: The Semicolon in Rust by pcwalton on Thursday October 18, 2012 @06:46PM (#4671459)
I implemented basically this in Rust, and it was overwhelmingly rejected by the community at the time. People seem to like the strict typechecking.