Today I introduced another tiny DSL in coaster with the '[]' string suffix in requestargs:This is the second instance: load_models accepts parameters in the "parent.child" convention to look up the child object inside the parent object.DSLs are an anti-pattern because they introduce custom parsers that will require maintenance over time, but both these instances are tiny and I couldn't find an obviously better way to express them.Thoughts?
Got it. ('param3[]', int).Doesn't look very pythonic though.
On Wed, May 8, 2013 at 2:48 PM, Anand Chitipothu <anand...@gmail.com> wrote:
Got it. ('param3[]', int).Doesn't look very pythonic though.Exactly. But, how else?('param3', int, list)('param3', int, True)('param3', int, 'list')('param3:list', int)('param3:int', True)All of which look questionable. Lists in request parameters are a unique case so the '[]' syntax felt like a decent compromise. There won't be anything else in future.** Assuming we never get to complex record decoding, the path that led to Rails's YAML vulnerabilities.
If you are using 'params3[]', then why not do it for type as well? Why a tuple?
@requestargs('param1', 'param2:int', 'param3[]:int', ...)
@requestargs(param1=str, param2=int, param3=[int], ...)