On Sat, Aug 1, 2020 at 1:41 PM Kevin Chadwick <m8il1i...@gmail.com> wrote: > > On 2020-08-01 18:34, Ian Lance Taylor wrote: > > Personally, when it comes to interpretation by the reader, I think > > that the new generic syntax in the design draft is fairly minor. I > > don't see how a template based approach will be any clearer; it won't > > be less clear, but I don't see why it will be clearer. Perhaps you > > could write down a couple of short examples to show why using > > templates would be clearer for the reader. > > I'm thinking (whilst likely missing some important things) that a reader > wouldn't even need to know the Generics syntax to understand the executed > code. > Just the author. To become an author, the reader could look at the templates > compared to the .go code output. It's certainly true that it wouldn't be worth > the effort, if the Generic syntax is easily understood anyway. > > However, I'm not sure the following is a trivial amount of work to understand, > especially if it becomes part of a more complex piece of code? > > "https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md"
I agree that the design draft is not trivial to understand, but, similar to what you suggest, I hope that readers can understand it clearly. See the examples. And don't forget that even with templates, there will have to be some way to describe what types are permitted, which is the source of much of the complexity in the current design draft. 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWtt7AvEwAdCRn4PXcLpuHX-rp0qnPuajdzUC9c5g%2BA0w%40mail.gmail.com.