fukamachi / ningle

Super micro framework for Common Lisp
http://8arrow.org/ningle/
273 stars 25 forks source link

param alists #4

Open chfin opened 9 years ago

chfin commented 9 years ago

The new param data structure is very cumbersome to access. Even the readme misses some cdrs.

I would suggest to introduce something like (ningle:get-param params "foo") as a shortcut for (cdr (assoc "foo" params :test #'string=)) since it preserves the argument order of getf.

For :splat and :captures one could either add (ningle:get-splat params) and (ningle:get-captures params), or use equal instead of string= for ningle:get-param, making it a drop-in replacement for getf.

Also, the documentation at http://8arrow.org/ningle/ has to be updated accordingly, it sill says getf.

chfin commented 9 years ago

Mh, actually get-param cannot be compatible to the old getf behavior since it takes strings instead of keywords for normal parameters. So probably introducing separate functions for :splat and :captures is reasonable. These changes should also be clearly announced somewhere since they break existing code.

fukamachi commented 9 years ago

Association list utilities may be useful not only for ningle. I think it's not the scope of ningle and it would be better to be written as an individual library.

Anyway, some documentation errors should be fixed soon (hopefully).

chfin commented 9 years ago

Since get-param is rather specific for ningle (not so much a general alist utility), I would say that it's justifiable include it in ningle. But, on the other hand, I see that it is not really necessary and if the goal is to keep ningle simple, it should probably not be included.