Sorry, it is confusing… because then someone chimes in and says ‘no’ to 
operator overloading which would make that impossible, which makes the example 
impossible for arbitrary X.

I guess I don’t understand the problem with using “method names” e.g. Less() in 
generic code - yes it is a little more verbose - but it avoids the traditional 
problems with operator overloading leading to obtuse code.

> On Oct 18, 2018, at 2:28 PM, Burak Serdar <bser...@ieee.org> wrote:
> 
> On Thu, Oct 18, 2018 at 1:22 PM robert engels <reng...@ix.netcom.com> wrote:
>> 
>> Can you explain this a bit more, I must be missing something. Using the 
>> example:
>> 
>> func F(a,b type T like(int,X)) {
>>  if a<b {
>>    ...
>>  }
>> }
>> 
>> How do you pass a struct to F because < isn’t valid on structs ???
> 
> You missed the part that said "provided X is a type that supports <".
> This was a hypothetical case where we could define < for X.
> 
> 
>> 
>> Which is why I proposed that < maps to Less() and then the primitives 
>> simplicity implement these various methods, and user defined structs MIGHT.
>> 
>> That way you write the code using Less(), and it works with primitives as 
>> well.
>> 
>> 
>> 
>> 
>>> On Oct 18, 2018, at 2:13 PM, bjorn.de.me...@gmail.com wrote:
>>> 
>>> I don't think this is fear, but rather KISS. The reason many people dislike 
>>> contracts from the official proposal is that they are complex and don't 
>>> have a very Go-like syntax.
>>> 
>>> I like this like syntax because I feel it is more Go-like, but also because 
>>> it solves the operator problem rather elegantly and would allow us to unify 
>>> the strings and bytes packages into one generic package.
>>> 
>>> --
>>> 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.
>>> For more options, visit https://groups.google.com/d/optout.
>> 
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to