Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > WebObjects Developer's Guide


Table of Contents Previous Section

"Modern" WebScript Syntax

WebScript supports two syntax styles. The style that you've been reading about up until now is "classic" syntax, which is based on the syntax of Objective-C. If you're more familiar with languages such as Visual Basic or Java, you may be more comfortable with the alternate syntax style, called "modern" syntax.

The differences between classic and modern WebScript syntax are summarized below:

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 is 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.

Table of Contents Next Section