Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50997 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24789 invoked from network); 10 Dec 2010 18:04:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2010 18:04:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=chadfulton@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chadfulton@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.174 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chadfulton@gmail.com X-Host-Fingerprint: 209.85.214.174 mail-iw0-f174.google.com Received: from [209.85.214.174] ([209.85.214.174:53478] helo=mail-iw0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/8B-59644-1CB620D4 for ; Fri, 10 Dec 2010 13:04:50 -0500 Received: by iwn9 with SMTP id 9so6227737iwn.33 for ; Fri, 10 Dec 2010 10:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=ZGlEOjsba0EENVHH/vVNmQcVwMHZ+8MwJ0jM069q494=; b=CxoA1s+agNHwVbjkMa4rt7JwlwfZexvjzS8u1bwoLM1kDuqquFP4mPLdPRA1eVt9u4 Wt8RkqFY+S5shc51WaaeWAKv3J4/NWfyJD6jjs0l6orYoUUnbKTCG694ePmiZpmM3AGg 7VIFZxTrjxrk7rys21mQiA8b3Mp65zHUZW680= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=r0hUw0GSLrVQ4akKQDIkWFqSSh/05fpINMr8okOUw7Ub9p86UdA20hiUMKU87MPZfY vqbj5UURmnd6i5xUsu2zq2zwaZ5+1p6Ewk9OuI9B9R+9T4MHMsRjHi4zI/UT4JSzvsxZ 9qJqNRzPSHKq0AytsHIfwOUMtrHUTu2g0Xm0A= Received: by 10.231.156.1 with SMTP id u1mr760245ibw.52.1292004287466; Fri, 10 Dec 2010 10:04:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.170.66 with HTTP; Fri, 10 Dec 2010 10:04:26 -0800 (PST) In-Reply-To: References: <9CD87200-33CB-40BE-A81C-36FD7471F59C@stefan-marr.de> <9A31F2F9-ED6B-4BE5-A6E2-EB4536E8667F@stefan-marr.de> Date: Fri, 10 Dec 2010 10:04:26 -0800 Message-ID: To: Nathan Nobbe Cc: Martin Wernstahl , Stefan Marr , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks From: chadfulton@gmail.com (Chad Fulton) On Fri, Dec 10, 2010 at 9:29 AM, Nathan Nobbe wrot= e: > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl wro= te: > >> First i have to say that I am not a PHP internals developer, but as a us= er >> I think it would maybe be better to just let the trait use the implement= s >> keyword, and "copy" that to the classes utilizing the trait? >> > > This is actually in the RFC as a rejected proposal > > http://wiki.php.net/rfc/traits#rejected_features > > But what I'm talking about is something different. =A0We're not trying to= say > 'these are the methods implemented in the trait', rather, 'this trait > expects a class it is used with to be of a certain type or implement a > certain interface' for the trait to do its job. > > -nathan > Shouldn't the burden be on the programmer to make sure the trait works with the class using it rather than on the compiler? If they try to use a trait that requires methods that don't exist, it will error out anyway, so it won't be difficult to debug.