The implicit nature of contracts seems like a major sticking point.  If you are 
writing something like 1 << t to express “unsigned integer” then it seems like 
it would obviously be more explicit to directly state “unsigned integer”.  
contracts look really elegant, powerful, and well-defined from the perspective 
of the *compiler*, but from the *end-user perspective*, they really seem very 
indirect and implicit.  Overall my sense is that Go puts a lot more value on 
the end user rather than the compiler..

WRT the objection of introducing a bunch of new keywords to explicitly specify 
what is otherwise indirectly specified by contracts, there is already a full 
explicit list of such things in the reflect.Kind type.  Could we not just use 
that directly?  Given that contracts are supposed to be relatively rare anyway, 
requiring the inclusion of reflect might be acceptable.  And this is 
well-understood and widely used already.

- Randy

> On Sep 8, 2018, at 7:10 PM, Rob Pike <r...@golang.org> wrote:
> 
> "A contract is a compile-time description of which types are permitted
> for a polymorphic function or type."
> 
> No, it's not. It's a collection of statement-like operations that must be 
> legally compilable, under restricted circumstances, by the type at the point 
> of instantiation, plus some special rules for cases that are hard to handle 
> that way. It's more of an illustration, an example, than a description. It's 
> implicit, roundabout, a little magical.
> 
> I'm not criticizing the design, although it might sound like that, but there 
> is a certain lack of precision, of indirection, that makes this harder than I 
> hope it might be. And the first place to be precise is in the language that 
> defines what these new concepts are.
> 
> -rob
> 
> 
> -- 
> 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