Skip to content

Instantly share code, notes, and snippets.

@chinmaygarde
Created August 26, 2013 00:55
Show Gist options
  • Save chinmaygarde/6337271 to your computer and use it in GitHub Desktop.
Save chinmaygarde/6337271 to your computer and use it in GitHub Desktop.
// Omega Spec
Ω interface Foo < Base :SomeProtocol
Ω (read, write) Bar *bar;
Ω (read) Baz *baz;
Ω (read, copy) Burrito *burrito;
Ω (atomic, write) Bang *bang;
Ω void someMethodCall(Bang *bang, int intArg);
Ω end
Ω implementation Foo
Ω void someMethodCall(Bang *bang, int intArg) {
Ω.bar = bar;
Ω.baz = baz;
Ω.burrito = burrito;
Ω.bar = bar,
.baz = baz,
.burrito = burrito;
// OMG Recursive call
Ω.someMethodCall(bang, intArg);
}
Ω end
// someMethodCall(object, bang, intArg);
// Or
// Ω object.someMethodCall(bang, intArg);
// Equivalent Objective C
@interface Foo : Base <SomeProtocol>
@property (nonatomic, retain) Bar *bar;
@property (nonatomic, readonly) Baz *baz;
@property (readonly, copy) Burrito *burrito;
-(void) setBang:(Bang *) bang;
-(void) someMethodCall:(Bang *) bang someInteger:(int) intArg;
@end
@implementation Foo
@synthesize bar=_bar;
@synthesize baz=_baz;
-(void) someMethodCall:(Bang *) bang someInteger:(int) intArg {
self.bar = bar;
self.baz = baz;
self.burrito = burrito;
// OMG Recursive call
[self someMethodCall: bang someInteger: intArg];
}
@end
// [object someMethodCall: bang someInteger: 2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment