Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20254 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85278 invoked by uid 1010); 22 Nov 2005 22:54:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85263 invoked from network); 22 Nov 2005 22:54:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2005 22:54:23 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:40327] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 9F/72-11378-E91A3834 for ; Tue, 22 Nov 2005 17:54:23 -0500 Received: from [192.168.1.3] (dslb-084-063-025-117.pools.arcor-ip.net [84.63.25.117]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id C7329610284; Wed, 23 Nov 2005 00:00:13 +0100 (CET) Date: Tue, 22 Nov 2005 23:54:36 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <797358253.20051122235436@marcus-boerger.de> To: Matthias Pigulla Cc: Rasmus Lerdorf , internals In-Reply-To: <00A2E2156BEE8446A81C8881AE117F192C1C4F@companyweb> References: <00A2E2156BEE8446A81C8881AE117F192C1C4F@companyweb> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: AW: [PHP-DEV] PDM Meeting Notes From: helly@php.net (Marcus Boerger) Hello Matthias, Tuesday, November 22, 2005, 10:29:09 PM, you wrote: >> I don't see why you can't specify that a class definition must have a >> constructor. Obviously the constructor is not for the >> interface itself. > Ok, that is, having __construct in the interface asserts that everything > you get passed (as an implementation of the interface) has been > constructed by a constructor that has a certain signature? :--/ Of > course it also doesn't make sense to call __construct on the > implementation passed along. > Luckily this is nothing I'm forced to write in my code ;). > I only wanted to utter I have a Bad Feeling(TM) if you invest time and > effort to make stuff like this work if the result is something that > seems to make no sense [to me only?]. And once you allow it, be sure ppl > out there use & abuse it and will complain should you ever have to > remove it again. The patch is ready already and actually it is a single line change that was obvious from the first place. What really causes work here is explaning this over and over again. > I'm just trying to make up a scenario where the above might make sense - > it could be where you have something like a factory method. It has a > type hint on it's argument to make sure what gets passed in implements a > certain interface. > That interface defines the signature of __construct, so the method can > construct instances of the "thing" - only knowing that the instances > constructed will implement the interface (?), but not knowing their > implementation. > But how should it construct instances? new INameOfTheInterface()? And > besides that, problem is again that the "thing" passed in would have to > be something representing a class, and not an instance of the class > itself. You could always (gut feeling) re-design this to work "the usual > way" by passing in something representing a class and providing > behaviour to construct instances. The typical way out is to completley re-design the software once reached this need or change to reflection to at least prevent from more severe errors. Best regards, Marcus