Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66976 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69414 invoked from network); 5 Apr 2013 11:12:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Apr 2013 11:12:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.175 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.175 mail-ob0-f175.google.com Received: from [209.85.214.175] ([209.85.214.175:38146] helo=mail-ob0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/22-57919-E81BE515 for ; Fri, 05 Apr 2013 06:12:15 -0500 Received: by mail-ob0-f175.google.com with SMTP id va7so3511244obc.20 for ; Fri, 05 Apr 2013 04:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=p0i4egW26WU+vJfDGnHXRnAMFJ4sBU5BBc5U/B2hok4=; b=OmcWkrzKFYL9vyYwwLO3d7rItlkI9jH2QQcdAF7ufWzsS7V8hz3gbAPqbFdHZHjIJt 0uP/JO9MBxd+7CL8V/DlJtpIBpqClYEaet/kgneUw1za0IeECcLUfra1qeTIX6PAnKVW dMxpJZX7Gmv1e9evA7tyNqHusQD8npyHF4Rmx3rkgdjo+nXRi2CXq8dV+igKWUE1MHT5 c6oxQ/8iHVDlQwtJXwpbKitATVZkooFVj0LU2iu0WYHYM9qLBMxwyBo345Agh+fhEEKu jOjGDH+V8zal4y+M0nK42fVue6uBN0RGLiJoGGlCkPlrUuvspDlVNjSPKdB5yMalOx7Y jOHw== MIME-Version: 1.0 X-Received: by 10.182.155.66 with SMTP id vu2mr7578634obb.6.1365160331488; Fri, 05 Apr 2013 04:12:11 -0700 (PDT) Received: by 10.182.49.136 with HTTP; Fri, 5 Apr 2013 04:12:11 -0700 (PDT) In-Reply-To: References: Date: Fri, 5 Apr 2013 13:12:11 +0200 Message-ID: To: Madara Uchiha Cc: PHP Internals Content-Type: multipart/alternative; boundary=f46d04479faf9eb94404d99b2825 Subject: Re: [PHP-DEV] Inconsistency in class definition/usage order From: nikita.ppv@gmail.com (Nikita Popov) --f46d04479faf9eb94404d99b2825 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Apr 5, 2013 at 12:39 PM, Madara Uchiha wrote: > After I saw this question on Stack Overflow: > > http://stackoverflow.com/questions/15688642/how-does-a-class-extension-or-interface-work > , > I realized that the guy was right. > > Is there an explanation for this, or is it just one of those things > that got overlooked? > > Should something be done? (i.e. enforcing class usage only after > definition?) > Did you also read the answer to that question? I think it does a good job at explaining why it is not possible. Extending a class or implementing an interface makes the class definition "conditional", because it now has a dependency on the extended class or implemented interface. To make it clearer, consider this example: