Documentation Archive Developer
Search
Table of Contents Previous Section

WebScript for Objective-C Developers

WebScript uses a subset of Objective-C syntax, but its role within an application is significantly different. The following table summarizes some of the differences.

Objective-C WebScript
Is compiled Is interpreted
Supports primitive C data types Supports only the class type
Performs type checking at compiled time Never performs type checking
Requires method prototyping Doesn't require method prototyping (that is, you don't declare methods before you use them)
Usually involves a .h and a .m file Stands alone (unless inside of a component directory)
Supports all C language features Has limited support for C language features; for example, doesn't support structures, pointers, enumerations, or unions
Methods not declared to return void must include a return statement Methods aren't required to include a return statement
Has preprocessor support Has no preprocessor support-that is, doesn't support the #define, #import, or #include statements
Uses reference counting to determine when to release instance variables Automatically retains all instance variables for the life of the object that owns them. Automatically releases instance variables when the object is released.

Here are some of the more subtle differences between WebScript and Objective-C:

Of course, the most significant difference between Objective-C and WebScript is that in WebScript, all variables must be objects. Some of the less obvious implications of this are:

Table of Contents Next Section