There are three things that I'm looking to do with Tangent generic methods that deviates from the norm:
- Generics defined alongside the variable.
This one is kinda straightforward. Instead of public void foo(T x, T y) the declaration will be public void foo( x, y). Should make reading the things a little easier, but it's mostly done to disambiguate the syntax. Multiple declarations of the same name are the same variable (as above).
- Constraints defined alongside the generic identifier
A little less straightforward, but again, hopefully something that's not too weird. This moves the simple type constraints within the angle bracket declaration. Example:
// C#public void foo() where T:HasName { }// Tangentpublic void foo(){}
I'm not quite sure if I'll go with that syntax or more of the Identifier:Constraint style. Either way, keeping the simple stuff declared alongside the generic itself. Again, declaration closer to the usage should be a little more readable, but the gain is mostly in aiding phrase usage.
- Types as params
Speaking of phrases, I'd like to allow type parameterization in phrases more naturally. print foo to string instead of print foo.ToString() or even print foo to(). This will aid in consistency within the language, allow for more straightforward specializations, and aid in the psuedo DSL programming.
And combined with the way method groups pick specializations it should allow me to construct stuff like is and as or even parameterized constructors within the language itself rather than needing hooks under the hood.
But for now, back to work.