Forum OpenACS Development: Re: TWiST OpenACS package

Collapse
2: Re: TWiST OpenACS package (response to 1)
Posted by Tom Jackson on
One important change that I forgot to mention is a change in how to specify a <ws>proc. Anyone upgrading will need to make a few changes to their configuration files. The change is in the input and output types. In the original release, each input parameter (proc args) was limited to zero or one. This exactly matched the Tcl proc signature, and the only possibility was that if a parameter was optional, you had to provide a default value. Either one implied the other. So this argument list looked identical to a Tcl procedure arg list, with the addition of a type specifier stuck on to the parameter name. The new features required that this format change to be the same format as used in <ws>element and in the return spec in <ws>proc.

Here is an example:

<ws>proc ::stock2::Stock {
    Symbol:stock2::symbol
    {Verbose:stock2::verbose "1"}
} {
  ...
} returns { ... }

Is now formatted like this:

<ws>proc ::stock2::Stock {
    {Symbol:stock2::symbol}
    {Verbose:stock2::verbose {minOccurs 0 default "1"}}
} {
  ...
} returns { ... }

The first list element is unchanged with format "Name:typeSpec", and at least the name is required here. The second element is any additional information as a name value list, exactly what would be used to create a tcl array. Unless otherwise listed in this list, minOccurs = 1, maxOccurs >= minOccurs > 0, no default value and nillable is not set. So the following are equivalent:

{OptionalArg {default "abc"}}
and
{OptionalArg {minOccurs 0 maxOccurs 1 default "abc" nillable false}}

This change was pushed all the way through to tWSDL which used a different format. When TWiST was being developed, the complexity of the original format was discarded, and the result was a lot of additional code in TWiST to convert to the old format. Now all the logic has been pushed into a small procedure, greatly simplifying the TWiST code, and providing a single data structure to maintain.