Forum OpenACS Development: ad_page_contract parameter order

Posted by Tom Jackson on

Well I'm confused. ad_proc seems to require all switches to appear before the positional, unnamed, parameters. Yet there is some magic with ad_page_contract which allows the unnamed 'docstring' to appear before optional switches. The magic apparently is accomplished by using the 'args' parameter.

My question is: why isn't this the default, un-switchlike params should be assumed to be the ordered positional params, or in other words, if it isn't a switch or switch value, it should be a positional param.

This would mess with the error of "No value for -param...", as you wouldn't detect it in all cases.

I want to write a proc that allows documentation, per call, like ad_page_contract. It would be nice if this were possible without too much trouble, maybe with a wrapper for ad_proc, say ad_proc_extended?

Another note is that you can't browse the actual tcl source, you only get to see the massaged source created by ad_proc.