Forum OpenACS Development: Re: ad_parameter deprecated in favor of parameter::get?

Collapse
Posted by Tom Jackson on
Hmm, quite interesting. I would think that required arguments would not need to be named. What would be the point of that? Hey, but the OpenACS style is to flip all the tcl conventions around anyway. Required parameters in ad_procs come after the options, unlike tcl. None of this makes anything easier for the novice OpenACSer, although a complete novice might not notice anything funny.
For, um, posterity, I just wanted to note that Tom's statement above that "the OpenACS style is to flip all the tcl conventions around anyway. Required parameters in ad_procs come after the options, unlike tcl." is, AFAIK, completely untrue - there are no standard Tcl conventions when it comes to ordering of optional vs. required parameters, nor named vs. un-named parameters.

This is easily demonstrated by reading the Tcl docs for various Tcl commands. Many, like string, seem to have all the named optional arguments first, all required un-named arguments next, and maybe a few extra un-named optional arguments at the end. Others, like clock format, have a required un-named argument first, with optional named arguments after it.

So I hope these examples from the Tcl core put that particular red herring to rest.

The OpenACS ad_proc standard of "all named -foo parameters first, then all un-named positional parameters next" is at least completely consistent with unix command-line usage parameter ordering (which inspired it), and at least in that one respect, is used consistently throughout OpenACS.

(The whole "parameter::get -parameter $parameter_id" foolishness that started off this thread, and the related question of whether parameters should generally be named or un-named, are of course entirely separate matters. And here and now, I am specifically not addressing those at all.)