On Tuesday, June 4, 2019 at 3:51:43 AM UTC-4, Michal Strba wrote:
>
> > It at least
> feels more like go, syntax-wise, than most, except for the num part, 
> which seems like an afterthought.
>
> It is an afterthought. It wasn't in the original proposal and was invented 
> as a way to enable functions like Min, Max, and so on. But I realized that 
> it actually enables many cool things like various generic math structures, 
> vectors, matrices to work with arbitrary numeric types.
>
> It is a special case, but if you try and make it general, you end up with 
> some sort of contracts, which may or may not be what you want, but is what 
> I've been trying to avoid here.
>

I commented on your gist, but let me add this here. I don't believe there's 
anything wrong with the concept of contracts. They are necessary to 
validate usage. What your proposal suggests to me, however, is that 
contracts can be defined inline, at the point of generic function 
definition, instead of having a separate "contract" construct. It'll be 
compiler's job then to validate generic function usage.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a9b35631-cea3-446a-bb5a-8c86d4b4b7fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to