How would you express the equivalent of

func Min[T constraints.Ordered](a []T) T {
    min := a[0]
    for _, v := range a[1:] {
        if v < min {
            min = v
        }
    }
    return min
}

using this syntax? More generally, it is probably useful to go through the
examples from the design draft
<https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#examples>
and check if they can be clearly expressed using your suggested syntax.

On Tue, Jan 19, 2021 at 9:01 PM Kevin Chadwick <m8il1i...@gmail.com> wrote:

>
> >> Seems to me that most generics implementations use a capital letter
> >> abstracted type syntax that I hate.
> >>
> >
> >This is just a convention and not part of the syntax, which means it's
> >irrelevant to the discussion about the proposal. You can easily use
> >lowercase letters/identifiers:
> >https://go2goplay.golang.org/p/eWgJSLNTZw8
>
> I was inquiring about the possibility of no identifiers or abstraction but
> simply like Gos non generic functions (possibly reversed if needed). Using
> type OR type.
>
> func (String | []byte firstInput, myType | publicKey secondInput)       {
>
>       firstInput[0]
>       firstInput[[]byte]
> }
>
> --
> 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/17BEE437-A5BB-4152-8215-B3F27A7265C1%40gmail.com
> .
>

-- 
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/CAEkBMfEh0-BM3-QKXgDRDAn00Rw49mSg0vtwOG5omaPx9c%3DDjg%40mail.gmail.com.

Reply via email to