On Tuesday, 10 May 2022 at 10:49:06 UTC, Andrea Fontana wrote:
On Tuesday, 10 May 2022 at 08:32:15 UTC, Sebastiaan Koppe wrote:
The difference is that with the route uda you can *only* map
routes 1:1 exhaustively. With your approach it is up to the
programmer to avoid errors. It is also hard to reason about
the flow of requests through all those functions, and you have
to look at the body of them to determine what will happen.
Sorry I don't follow you
It is simple, since all your handler are effectively chained, any
error in any one of them can cause later ones to fail or
misbehave. This decreases locality and increases the things you
have to reason about.
There are other benefits to uda tagged endpoints too, for example
they are easier to nest, or to programmatically generate them. In
vibe-d I added the default option of generating OPTION handlers
for every regular endpoint. This is required for CORS.
In any case if you want to use a different routing strategy
it's quite easy. I really don't like libraries that force you
to use their own style/way.
That is good.