Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18811 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56255 invoked by uid 1010); 13 Sep 2005 05:37:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56240 invoked from network); 13 Sep 2005 05:37:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2005 05:37:57 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:51260] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 56/6A-62395-4B566234 for ; Tue, 13 Sep 2005 01:37:56 -0400 Received: from [192.168.1.43] (dsl-082-083-234-176.arcor-ip.net [82.83.234.176]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 1EEDF35C37E; Tue, 13 Sep 2005 08:00:30 +0200 (CEST) Date: Tue, 13 Sep 2005 07:37:50 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <454490112.20050913073750@marcus-boerger.de> To: Jeff Moore Cc: PHP Developers Mailing List In-Reply-To: <253fbb6f28c5943cfce697c54ace09d0@procata.com> References: <253fbb6f28c5943cfce697c54ace09d0@procata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Subject and Observer Interfaces From: helly@php.net (Marcus Boerger) Hello Jeff, there is no way in implementing multi-whatever observer and subjects typesafe. If you want that you'd end up calling them MySubjectWhatever, MySubjectWhatnot, MySubjectWhatelse, ... and MyObserverWhatever, ... The other thing you mentioned, sending information along, is not necessary because you have access for what you really need, at least you can give the access yourself by your design and i strongly encourage you do so. The only thing that can be usefull sometimes is being able to prevent some observers from being notified. But that would require PHP dealing with optional parameters in its signature checking rules and i must admit that i couldn't get that to work. regards marcus Tuesday, September 13, 2005, 7:07:47 AM, you wrote: > Would it be possible to remove the Subject and Observer interfaces or > at least delay them until a later release? > The problem with the Observer interface is that any class implementing > it is only capable of receiving one kind of notification (update) and > there is no capability to send any additional information. > The problem with the Subject interface is that it can also only support > one kind of observer. > Together these are harsh restrictions that would limit the use of these > interfaces to only the most trivial applications. These interfaces are > fine as a textbook example of the observer pattern, but I don't see > them as generally useful enough to have as part of the language. > Regards, > Jeff Moore Best regards, Marcus