Modern” webscript syntax – Apple WebObjects 3.5 User Manual
Page 179

WebScript Language Elements
179
[self application]
WOComponent also defines a session method, so you can do this to retrieve
the current session:
[self session]
Sometimes, you actually do want to invoke the superclass’s method rather
than the current object’s method. For example, when you initialize an
object, you should always give the superclass a chance to perform its
initialization method before the current subclass. To do this, you send the
init
message to
super
, which represents the superclass of the current object.
- init {
[super init];
// my initialization
return self;
}
The
nil
word represents an empty object. Any object before it is initialized
has the value
nil
.
nil
is similar to a null pointer in C. For example, to test
whether an object has been allocated and initialized, you do this:
if (myArray == nil) //myArray hasn’t been initialized.
This next statement also tests to see if
myArray
is equal to
nil
:
if (!myArray) //myArray hasn’t been initialized.
“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:
•
Method Definition
Classic:
- submit {
// <body>
}