Re: reference caller object

From: Date: Thu, 17 Sep 2009 17:22:27 +0000
Subject: Re: reference caller object
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-45595@lists.php.net to get a copy of this message
On Thu, Sep 17, 2009 at 10:05 AM, Chris Trahey <ctrahey@csisd.org> wrote: > For each use case, there are going to be ways to acheive results without > new functionality. I think this feature doesn't make the impossible > possible, it gives developers a consistent interface to access an object > that is potentially very relevant, and perhaps not desired to be necessary > in the method signature. > > The decision to include a feature like this should not be made based on a > particular use-case, but instead on the idea that the sender of a message > should be able to be identified without enforcing a certain method > signature or pulling a full backtrace. To me, this feels like a basic > element of OOP. I do not think your example provides a consistent interface but simply a way to be less consistent. I think it would lead to users relying on caller to implement certain methods and may not do the necessary type checking before calling. Furthermore by requiring type checking in the body of the caller, you are adding a step that IMO is less clean then passing the instance. Using type hinting and passing objects make the developer very aware of the api they are using, that in itself enforces consistency. I would like to say I appreciate reading all feature suggestions on this list as well as yours and am not debating to debate; but am not very interested in having to deal with the possible bad design choices and tracking down "call to undefined method" errors this would lead to as a user of PHP. -Chris

« previous php.internals (#45595) next »