News for hackers. Stuff that matters.
Re:Routing Enhancements for Go 1.22 by Someone on Tuesday February 13, 2024 @06:18PM (#39364239)
It requires less string processing, (for the first option) removes the possibility to mistype a verb, allows for (slightly) better autocomplete, and better reflects how I describe the http protocol. You do “a GET request on an URI”, not a “GET URI”.

I still think it would not be good, though. For me ‘Handle’ sounds like an instruction to do something, but it only adds/registers a handler.

Also, why require multiple calls to, essentially, pass a set of (pattern, handler) pairs? I think I would have chosen to make a single call “here are the patterns to register and their handlers”. Most tools would have to make only one such call.

It possibly also could be more efficient because the API wouldn’t have to have intermediate states where it can handle one type of request, than 2, 3, etc.

Re:Routing Enhancements for Go 1.22 by randomdata on Tuesday February 13, 2024 @07:17PM (#39364707)
> It requires less string processing

Why keep {id}, then? Why not remove the string processing entirely? You may mistype it. You lose better autocomplete. Seems like there is room for significant improvement, not just a minor change. To which there is still an opportunity to introduce a another API, so it's worth finding it.