Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Generics handle most of the places where you'd care about overloading. You don't need a variant of, eg, parseint for every integer size:

    generic parseint = {some_str
        -> magic_algorithm(str)
    }
(Actual parseint code: http://git.eigenstate.org/ori/mc.git/tree/libstd/intparse.my...)

And, yes, you can make things generic only in the return type, and have that inferred.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: