[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-09-11 Thread Di gg
Still a mistake there. All "MyReader" uses should be "*MyReader". On Friday, September 11, 2020 at 11:02:49 PM UTC-4 Di gg wrote: > Sorry, the last 4 lines should be: > > rs = (MyReader string)(rb) > _, _ = rs.Read(s) > rb = (MyReader []byte)(rs) > _, _ = r

[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-09-11 Thread Di gg
Sorry, the last 4 lines should be: rs = (MyReader string)(rb) _, _ = rs.Read(s) rb = (MyReader []byte)(rs) _, _ = rb.Read(bs) On Friday, September 11, 2020 at 11:00:12 PM UTC-4 Di gg wrote: > An example demostrating how to let Reader.Read support both string and > []byte para

[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-09-11 Thread Di gg
eader string = mrs _, _ = rs.Read(s) var rb Reader []byte = mrb _, _ = rb.Read(bs) rb = (MyReader string)(rs) _, _ = rb.Read(bs) rs = (MyReader []byte)(rb) _, _ = rs.Read(s) On Wednesday, August 26, 2020 at 1:16:49 PM UTC-4 Di gg wrote: > > > https://github.com/dotaheor/unify-Go-builtin-and-cust

[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-08-26 Thread Di gg
> whereas to use a map type parameter, its key and elements must also present in the declaration signarure or constraint definitions. sorry, missed some words here. It should be whereas for the official draft, ... On Wednesday, August 26, 2020 at 1:16:49 PM UTC-4 Di gg wrote: > >

[go-nuts] some interesting ideas: reuse package keyword to declare generics

2020-08-26 Thread Di gg
https://github.com/dotaheor/unify-Go-builtin-and-custom-generics/blob/master/use-package-as-gen.md This is an alternative generic idea set, which should be Go 1 compatible. It tries to use the same syntax forms as builtin generics. Different from the official draft, it adopts a