CocoaBasic compared to other BASIC dialects
CocoaBasic tries to match the syntax of REALbasic (by REAL Software) as good as possible
while using and enabling the Cocoa Framework as the underlying object
model. This results in some inherent differences as well as some
intended improvements.
- SUB and FUNCTION without arguments can omit the ()
- CASE labels can be of any type (besides nil) and even
expressions. Expressions are evaluated when executing the SELECT
statement.
- Duplicate CASE values are NOT checked (typically, the definition
coming later in the source code is used).
- Upper case and lower case characters ARE DISTINGUISHED in
variable names, method names, constants, classes, but NOT IN keywords
and builtin functions
- To catch exceptions, the code has to be enclosed by TRY and END
TRY
- The EXCEPTION statement has a different syntax
- The RAISE statement has different arguments (strings instead of a
class)
- The REDIM method is allowed for any variable - and may even
change the number of indices
- The msgbox function can display any value (is converted into a
string before showing the box)
- Functions can be called as procedures (the result is ignored) and
subroutines called as functions return nil
- There is no GOTO
- There is no ME reference to the current control like in REALbasic
- The DIM statement allows to dimension any set of variables and
mix plain variables with arrays
- Arrays can be dynamically DIMensioned, i.e. the DIM statement
accepts expressions
Last change: 14 Mar 2003 -
©hns@dsitri.de, 2003