Re: New egg: schematra
Rolando Abarca via Chicken-users <[email protected]>
| Newsgroups | gmane.lisp.scheme.chicken |
|---|---|
| Message-ID | <CADnrc4ApFhtGCEkT9KCwk2WGvaXxxxtYR8M_suQy9JFXDqbkYQ@mail.gmail.com> |
On Tue, Aug 19, 2025 at 12:14 AM siiky <[email protected]> wrote: > Hey, > > This looks pretty good! > thanks! > One small thing to fix: the HTTP verbs[0] are macros, not procedures, so > they should be tagged with `<syntax></syntax>` instead[1] in the wiki > Oops. Fixed! > One question: will the path argument of HTTP verbs always be a single > element (`(path)`)? and if so, there's a reason for the extra parens? > (other than easier backwards compatible extensibility) > I was passing params as the second "argument" for the route handlers, but that prevented the params to be modified by middleware, so I moved to use current-params as a parameter that can be modified in the routing chain. This works great but now there's only one element in that list, because I'm not sure if I'll need something else in the future I decided to keep the list with a single element. Future proofing more than backwards compatibility, but I guess it can be both depending where in the timeline you're looking at 😅. > One suggestion for future versions: using alists for `(current-params)` > may be fine, but don't force users to know that it's an alist, especially > to use different comparator procedures (`equal?`/`eq?`) to access one or > the other -- it's a bit ugly. :P (and hard to change in a backwards > compatible way, but who care about that amirite?) Given the rest of the API > I'm sure you can find a really good API for this as well! > Yeah, I'm not very happy with the current situation. I started using an alist because that felt like the best approach at first but immediately felt weird when adding route params vs query params and now I also added body-parsed params... feels messy. Maybe switching to something closer to how sxml passes params might make more sense. I'll think about this more. > [0] https://wiki.call-cc.org/eggref/5/schematra#route-definition > [1] https://wiki.call-cc.org/edit-help#tags-for-other-definitions > [2] > https://github.com/schematra/schematra/blob/94888a9787a55324c85412925c3f424ba3c39e06/schematra.scm#L241 > > Thanks for the egg, > You're more than welcomed. I'm having a blast building this, it's been a while since I had so much fun working on a software project 😂 - Rolando