Advanced webscript, Scripted classes – Apple WebObjects 3.5 User Manual
Page 181

Advanced WebScript
181
Note that in this last example the left parenthesis should occur at a break
between words when the modern message maps to an existing Objective-
C method (which, of course, follows classic WebScript syntax). When
WebScript transforms modern to classic syntax internally, it capitalizes this
character before concatenating the keywords of the selector. Thus, any of
the following are correct:
super.takeValuesFrom(request := request, inContext := context);
super.takeValues(fromRequest := request, inContext := context);
super.take(valuesFromRequest := request, inContext := context);
If you choose to use modern WebScript, there is another important caveat:
You cannot have methods with variable-length argument lists. Thus, you
cannot use methods such as
logWithFormat:
and
stringWithFormat:
. You can,
however, mix classic and modern WebScript in the same script file.
Advanced WebScript
In WebScript, you create subclasses of WOComponent, WOSession, and
WOApplication and you use declared variables of classes defined in the
Foundation Framework, Enterprise Objects Framework, or the
WebObjects Framework. For most WebScript applications, this is
sufficient.
Sometimes, however, you might want to subclass some other class or at least
extend the behavior of that class without having to resort to compiled code.
For these cases, WebScript allows you to do two things: create a scripted class,
which is a scripted subclass of anything other than WOApplication,
WOSession, or WOComponent; or create a category, which is a way to extend
the behavior of a class without subclassing it.
Scripted Classes
The syntax for creating a scripted class is very similar to the syntax for
creating a class in Objective-C. The instances of a class created in such a
manner behave like any other Objective-C object.
To create a scripted class, you specify the class interface in an
@interface...@end
block and the class implementation in an
@implementation...@end
block. To
ensure the class is loaded properly, the scripted class code should be in its
own
.wos
file. The following example is in a file named
Surfshop.wos
: