On Fri, Sep 7, 2018 at 5:29 PM, Rob Pike <r...@golang.org> wrote: > > Would this work? > > contract unsigned(u T) { > 1 << u > } > > It's another infelicitous horror, but I believe it exploits the only place > in the language where an unsigned integer is required.
Yes, that would also work (pace issue #19113). But this is a game of code golf. Why is it useful to say "this polymorphic function may only be instantiated with unsigned integer types?" Conversely, should we be looking for ways to remove this kind of generality from contracts? As you know, we had an earlier system for that, but it required adding a number of new concepts to the language; the current design draft adds very few concepts, but has the disadvantage of possibly excessive generality. Ian -- 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.