Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
A generic number type: num #3
Whether or not neugram adopts a full parametric type system, they come with a readability cost. Intermediate generalized types are given names like T, or U. A programmer reading code has to track possible meanings of these meaningless names, which is unfortunate.
This proposal is about introducing a single implicit type parameter:
Context implicitly defines
Functions and types can be parameterized over a single type parameter. The type parameter can only resolve to numeric scalar types and must have the name num. Its appearence anywhere in the type declaration means the function is generic:
When declaring a variable using type inference from a constant,
In a scope where
(The first comment of this issue is kept up-to-date with the current proposal.