Agreed, the following is where the disconnect is

> On Oct 20, 2018, at 10:40 AM, Ian Denhardt <i...@zenhack.net> wrote:
> 
>> // Do we need LinkedList(T)? Maybe not..
>> func (l *LinkedList) Add(n *Node) {
>>  n.next=nil
>>  if l.head==nil {
>>    l.head=n
>>  } else {
>>    l.head.next=n
>>  }
>> }

if I declare a “linked list” containing elements of MyNode, I want to make sure 
that the Add(), Pop() etc. are all type-safe and that they return MyNode, not 
Node.

I don’t want to write multiple linked lists… I want to write MyNode that 
contains my domain specific properties, and use the one implementation of 
LinkedList.

To be clear, this is only for that “performance case”, where I don’t want 
LinkedList to allocate internal nodes to hold the elements but the reasoning 
applies when using a simple LinkedList, and I want it to hold MyObj (which is 
not a Node, so the LinkedList needs to create Node instances).

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to