On Thu, 13 Sep 2018 10:29:21 -0700 (PDT) Manlio Perillo <manlio.peri...@gmail.com> wrote:
> `try` tries each block at compile time, and use the first block that > compiles successfully. How the reader of this will know what will compile and what not? Esp doing "by a finger"/"paper and pencil" codewalk?. But you just rediscovered the very clever technique under current generics proposal from the team: (just s/contract/try/ ;) Instead of trying to compile a generic func the contract is tried first so whole type matching is done for all substituted types at once and using current well tested compiler. If "contract" block does not compile, types do not fit. If it does, compiler is free to make a variant, compile it and (for positive outcome) tag an object code with current types for possible reuse then move on. I admired this approach for a moment, until I tried to make sense of what exactly "this contract" means for "given code" on a few contrived examples. It did not click. So while I still admire brilliancy of the compiler reuse, I don't think that it is good for Go. > Well, probably there are a lot of issue with this proposal. It just can't be read by a human. Compiler would cope with that. > Manlio > -- Wojciech S. Czarnecki << ^oo^ >> OHIR-RIPE -- 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.