On Mon, Jul 20, 2020 at 7:22 AM christoph...@gmail.com <christophe.mees...@gmail.com> wrote: > > I would like to insist on considering the D syntax using the ! for generics > instantiation. > > The first time I saw it, I was puzzled and found it unpleasant. But this is > just because it is unfamiliar and not intuitive. > Once I got used to it, I found it much simple than the C++ templates. In fact > I even found it easier to use than the C++ notation. > > The thing is that generic instantiation will be very frequent and most of the > time with only one template argument. The notation using a simple ! is then > much lighter and readable then a notation using parenthesis. > > Please, consider and favor the readability and code lightness of the most > frequent use with generics which is the instantiation with one type argument. > > Compare T!int with T(int) or T[int] or T<int>, or A!B!int with A(B(int)) or > A[B[int]] or A<B<int>>. > > Please take the time time to experiment it and optimize the most frequent use. > The D notation gave me the impression that use of generics was simple. Much > simpler than with C++. > > Go generics made a huge and good simplification by dropping the contracts. > Please, follow the same strategy for the instantiation of generics which will > be the most frequent occurrence in the code.
Honestly I find A(B(int)) or A[B[int]] to be clearer than A!B!int. I don't think A!B!int is horrible. I just don't think it is the best possible choice. Of course that is just my personal opinion. The sources for the experimental translation tool are available, so anybody can try the experiment you suggest. Even easier would be to rewrite the examples using the D notation, to see how they look. 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/CAOyqgcX%3Dy_ZH25JfvWvqN12VHhR6Lb7heqYvPhK2LzCtcwbaaA%40mail.gmail.com.