Hacker News new | ask | show | jobs
by merlincorey 2514 days ago
As a functional leaning programmer, I think it's striking that the resulting draft is essentially a curried function whose first parameter is the type!

    func Reverse (type Element) (s []Element) {
        first := 0
        last := len(s) - 1
        for first < last {
            s[first], s[last] = s[last], s[first]
            first++
            last--
        }
    }
This is later called like:

    Reverse(int)(s)
Which if this were a curried function, would also be callable like:

    Reverse(int, s)
Now I wonder if facilities for currying functions might be a higher level addition that could result in the same thing (so long sa we can pass bare types, which is part of this change as well).
1 comments

I hate to tell you, but you're on your way to dependent types.