You're right, string-based queries are very expressive. I intentionally avoided that here so readers could focus on how FTS indexes work internally. Adding a full query system would have shifted the focus away from the internals.
If you notice there are vv obvious optimizations we could make. I’m planning to collect them and put a these as code challenges for readers, and building string-based queries would make a great one :)
The counter argument is bunk, you change the comments when you change the code. It’s not hard. If you forget, them a reviewer will notice. If not, then you aren’t focusing enough attention on the finer details of a project, to your detriment.
Personally, I find that a lot of good, accurate comments and documentation helps me to trust a code base more because I can see that the devs cared and focused on the finer details rather than just tossing code over a fence at me.
Can't you just say that you used Claude and be done with it? I mean, I don't really care but in general I would refrain from posting "Show HN" with stuff that has been vibed, or state that you did since in that case it's even more interesting from my point of view, like you could describe how you kept everything under control during generation, etc...
I mean, no biggie and I don't understand the reaction but hey, I'm old so...
That said, totally fair read on the comments. Curious if they helped/landed the way I intended. or if a multi-part blog series would’ve worked better :)
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.