(no title)
buff-a | 14 years ago
file.rb:
require 'stuff'
class foo
def something
alert = UIAlertView._alloc \
._initWithTitle _S("Hello"),
:message, _S("I'm MobiRuby"),
:delegate, nil,
:cancelButtonTitle, _S("I know!"),
:otherButtonTitles, nil
alert._show
end
end
Instead offile.h
#import <stuff>
@interface foo
-(void)something:(BOOL)what andthen:(CGRect)thisthing
@end
and then file.m #import <otherstuff>
#import <yetmorestuff>
#import "file.h"
#import <oh shit is this in the right place?.h>
#import <i think this is ok>
#define SOME_HACK
#import <this better come after that define up there.h>
@implementation foo
-(void)something:(BOOL)what butthen:(CGRect)thisthing
{
alert = [[UIAlertView alloc]
initWithTitle:@"Hello"
message:@"I'm ObjC"
delegate:nil
cancelButtonTitle:@"I know!"
otherButtonTitles:nil];
[alert show];
}
Fuck that.1. Don't Repeat Yourself. Computer have more memory than 1986.
2. Don't forget to turn on warnings-as-errors, otherwise that code above will compile and then break because (of course you noticed) the method declaration doesn't actually match the declaration but the compiler doesn't care because its a brutal hack.
No comments yet.