delegation

Why aren't Python's superclass __init__ methods automatically invoked?

Why did the Python designers decide that subclasses' __init__() methods don't automatically call the __init__() methods of their superclasses, as in some other languages? Is the Pythonic and recommended idiom really like the following? def Superclass(object): def __init__(self): print 'Do something' def Subclass(Superclass)...

iPhone custom delegate problem

Hi, I have set up a delegate for my class 'HotRequest', but am having problems implementing it. The code for my class is below. Any ideas? Thanks HotRequest.h #import <Foundation/Foundation.h> @protocol HotRequestDelegate; @interface HotRequest : NSObject { NSString *requestString; id <HotRequestDelegate> delegate; } @prope...

jQuery Event.Target Problem

I don´t know if I have forgotten how to do so or if it´s a bug, but I just can´t find the caller's reference using jQuery. I´m doing the following: $(document).ready(function() { $('#parent a.item').click(doSomething); }); function doSomething(e) { // Alerts for demostrational purposes only alert(e.target); alert(e.cu...

Delegation and Modal View Controllers

According to the View Controller Programming Guide, delegation is the preferred method to dismiss a modal view. Following Apple's own Recipe example, i have implemented the following, but keep getting warnings that the addNameController:didAddName method is not found... NameDelegate.h @protocol NameDelegate - (void)addNameContr...

Is it possible to automatically coerce parameters passed to delegated methods (from the Array trait) using Moose/MooseX::Declare for Perl?

I'm creating a class which will contain a list of IP addresses, as Net::IP objects. I've wrapped the Net::IP object as a subtype (IPAddress), and defined a coercion from a string to IPAddress. Then I've added an attribute to the class called ip_list with the type ArrayRef[IPAddress], and delegated to the push method of the Array trait....

Accessing a class' instance variable (NSMutable Array) from another class

Hi all - new to Obj C and programming in general - learned a lot from this site and really appreciate everyone's contributions. My scenario is as follows (programming an iPhone game which explains the funny names) In my main gameLoop (which is in my view controller) if a certain condition is met I create an enemy - the cherry bomb if ...

Collision detection delegate scheme

Hey guys! My physics engine is coming along quite nicely (thanks for asking!) and I'm ready to start working on some even more advanced junk. Case in point, I'm trying to set up my collision engine so that an arbitrary delegate can be notified when a collision occurs. Let me set up a scenario for you: Say we have object A, object B, ...

Exposing aggregation through the interface vs. delegation

I have an Employee object which aggregates a few other objects, such as HRData and AssignmentHistory. In the past all of this logic was contained directly in the Employee object, but for testability and manageability I've split it to use aggregation. However, instead of exposing the aggregate objects directly, I've used delegation so tha...