← Back to context

Comment by haute_cuisine

4 days ago

Thanks for the link, very interesting data structure.

I'm wondering is it really worth dumping a general knowledge articles into code comments? To me it feels like the wrong place. Would just the wikipedia link be enough here?

I also notice a lot of comments like this

  // IsEnd checks if this is the EOF sentinel
  //
  // Example usage:
  //
  // if pos.IsEnd() {
  //     // We've reached the end, stop searching
  // }
  func (p *Position) IsEnd() bool {
      return p.Offset == EOF
  }

Is it really necessary to have a text description for a code like "a == b"? It would be really annoying to update comment section on every code change.

This is one of the typical issues when AI creates "code comments", because it always describes "What" is happening. A good comment should answer the question "Why" instead.

For the linked skip list module, a good comment could say why skip list was chosen over b-tree or other data structure and which trade offs were made. AI will never know that.