object-initialization

What's the point of this in objective-c

SomeObject *temp = [[SomeObject alloc] init] self.theObject = temp; [temp release]; Why is it always done that way? Why not self.theObject = [[SomeObject alloc] init]; ...

How to pass object/template as parameter in Javascript/jQuery

I'm attempting my first forray into jQuery. I'm trying to acheive the following, though I'm not sure of the terminology so will try to explain with an example using a kind of C#/pseudocode syntax. Say I want an (anonymous) object as parameter, looking something like: elemParameter { elemId, arg1, optionalArg2 } and I wan...

Dependent fields when using object property initialisation in C#

I was quite suprised today to discover that I can't do the following. public class NumberyStuff { public List<int> Numbers { get; set; } public int Total { get; set; } } var numbers = new NumberyStuff { Numbers = new List<int>{ 1, 2, 3, 4, 5 }, Total = Numbers.Sum() // "Numbers does not exist in the current context"...

Objective-C call specific class method

I have a class that has this in the initializer: @implementation BaseFooClass -(id) init { if (self = [super init]) { // initialize instance variables that always need to start with this value } return self; } -(id) initWithSomeInt:(int) someInt { if (self = [self init]) // <-- I need to make sure t...