3 ms·
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 =
by ori_b 13y ago
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.myr 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.