Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread Andrew Werner
Hey Roger, Thanks for taking the time to engage with me on this. Really appreciate it! On Monday, June 22, 2020 at 6:01:46 PM UTC-4, rog wrote: > > > > On Mon, 22 Jun 2020 at 22:49, Andrew Werner > wrote: > >> >> >> On Monday, June 22, 2020 at 5:42:12 PM UTC-4, rog wrote: >>> >>> >>> Thanks

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread roger peppe
On Mon, 22 Jun 2020 at 22:49, Andrew Werner wrote: > > > On Monday, June 22, 2020 at 5:42:12 PM UTC-4, rog wrote: >> >> >> Thanks for pointing this out. I'm cool with this approach. I'll update my library to utilize it (and consider also adopting the list.List, though I do like my

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread Robert Engels
The compiler could conceivably generate code that did that - and with aggressive inlining you would end up the same as native type code. I would argue that using raw slices in data structures leads to maintainability issues anyway. The key is higher level constructs that give you similar if

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread Andrew Werner
On Monday, June 22, 2020 at 5:42:12 PM UTC-4, rog wrote: > > > Thanks for pointing this out. I'm cool with this approach. I'll update my >>> library to utilize it (and consider also adopting the list.List, though I >>> do like my freedom to pool list nodes). >>> >> > Personally, I'd start by

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread roger peppe
> Thanks for pointing this out. I'm cool with this approach. I'll update my >> library to utilize it (and consider also adopting the list.List, though I >> do like my freedom to pool list nodes). >> > Personally, I'd start by re-using list.List, and only use pools if there really is a significant

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread roger peppe
On Mon, 22 Jun 2020 at 15:57, Andrew Werner wrote: > On Monday, June 22, 2020 at 10:17:01 AM UTC-4, rog wrote >> >> On Mon, 22 Jun 2020 at 14:59, Andrew Werner wrote: >> >>> Oh! It’s saying that *B implements the constraint, nifty. Is this idea >>> in the current proposal? >>> >> >> Yes. See >>

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread ajwerner via golang-nuts
On Monday, June 22, 2020 at 10:17:01 AM UTC-4, rog wrote: > > > > On Mon, 22 Jun 2020 at 14:59, Andrew Werner > wrote: > >> >> >> On Mon, Jun 22, 2020 at 9:45 AM roger peppe > > wrote: >> >>> >>> >>> On Mon, 22 Jun 2020 at 14:26, Andrew Werner >> > wrote: >>> Hey Rog, I think I

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread Andrew Werner
On Monday, June 22, 2020 at 10:17:01 AM UTC-4, rog wrote: > > > > On Mon, 22 Jun 2020 at 14:59, Andrew Werner > wrote: > >> >> >> On Mon, Jun 22, 2020 at 9:45 AM roger peppe > > wrote: >> >>> >>> >>> On Mon, 22 Jun 2020 at 14:26, Andrew Werner >> > wrote: >>> Hey Rog, I think I

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread roger peppe
On Mon, 22 Jun 2020 at 14:59, Andrew Werner wrote: > > > On Mon, Jun 22, 2020 at 9:45 AM roger peppe wrote: > >> >> >> On Mon, 22 Jun 2020 at 14:26, Andrew Werner wrote: >> >>> Hey Rog, >>> >>> I think I sent you a private reply earlier. My bad. I now see what >>> you're proposing in the first

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread Andrew Werner
On Mon, Jun 22, 2020 at 9:45 AM roger peppe wrote: > > > On Mon, 22 Jun 2020 at 14:26, Andrew Werner wrote: > >> Hey Rog, >> >> I think I sent you a private reply earlier. My bad. I now see what you're >> proposing in the first proposal think it makes a lot of sense. >> >> The thing that I

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread roger peppe
On Mon, 22 Jun 2020 at 14:26, Andrew Werner wrote: > Hey Rog, > > I think I sent you a private reply earlier. My bad. I now see what you're > proposing in the first proposal think it makes a lot of sense. > > The thing that I think I had missed was this piece of magic: > // New returns a new

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread Andrew Werner
Hey Rog, I think I sent you a private reply earlier. My bad. I now see what you're proposing in the first proposal think it makes a lot of sense. The thing that I think I had missed was this piece of magic: // New returns a new Dequeue instance using B as the block storage backing. func

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-22 Thread roger peppe
Thanks for the interesting use case, Andrew! I've experimented with a slightly different approach: https://go2goplay.golang.org/p/AkqzbWmpj6t It expects the caller to implement a method on the array to get a reference to the underlying storage, but that's fairly trivial to implement. I've

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-21 Thread Andrew Werner
Thanks for the reply! If I read it correctly, it is already possible to specify a type constraint as an Array of a given size and so the first part of the "What I might have expected" actually does work. I noticed that it works in that it works as a type constraint but I found that types

Re: [go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-21 Thread David Finkel
On Sat, Jun 20, 2020 at 1:22 AM Andrew Werner wrote: > [The body of this email is a duplication of the README in > https://github.com/ajwerner/go2dequeue/ > which also contains the sample implementation] > > Exercise building a dequeue with the go2 Type Parameter Draft > > This project is an

[go-nuts] Block-based data structures and the Type Parameters - Draft Design

2020-06-19 Thread Andrew Werner
[The body of this email is a duplication of the README in https://github.com/ajwerner/go2dequeue/ which also contains the sample implementation] Exercise building a dequeue with the go2 Type Parameter Draft This project is an exploration with the go2go / Type Parameters - Design Draft