Fun building on top of JavaScript (Objective-J)

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Fun building on top of JavaScript (Objective-J)

Post by Chris Corbyn »

Oh, and before you start pulling hairs out wondering why the most elementary stuff in ObjC isn't working in ObjJ, these two basic structures from ObjC:

Code: Select all

@interface MyClass : NSObject
{
}
 
- (void)aMethod:(NSString *)str;
 
@end
And

Code: Select all

@implementation MyClass
{
}
 
- (void)aMethod:(NSString *)str
{
  ... implementation here ...
}
 
@end
They only exist as a direct @implementation in ObjJ. You just don't need the header file with a @interface, all you need is a single .j file. It's just that JavaScript is less long-winded than C.

Code: Select all

@implementation MyClass : CPObject
{
}
 
- (void)aMethod:(CPString)str
{
  ... implementation here ...
}
 
@end
Other things that don't exist in ObjJ (yet):

* Protocols - I've requested it. Protocols are basically what we think of as interfaces in PHP/Java.
* Delcared properties do exist, but slightly differently using @accessors.
* Fast enumeration - JS already took that syntax :(
Post Reply