Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65105 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40580 invoked from network); 23 Jan 2013 03:37:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jan 2013 03:37:28 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.216.173 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.216.173 mail-qc0-f173.google.com Received: from [209.85.216.173] ([209.85.216.173:56713] helo=mail-qc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/24-12923-7FA5FF05 for ; Tue, 22 Jan 2013 22:37:28 -0500 Received: by mail-qc0-f173.google.com with SMTP id b12so861526qca.18 for ; Tue, 22 Jan 2013 19:37:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=uSCVDEcbIX0mTIwZhoYVQdkaerQUWB3pIDjYxaH1otA=; b=Hci0dujHRmMN+5oRgRwFMQ9aKaeMSMNL+HIVPAK8lnF6G9oMSMzK5f5rmQvC8i/p1a 1dFP/B2XmEcZYNZEhFAjqLygGyQLAI92Qyd7tTblZst3cMgPiVw0X4ejtNYEWlVhIo1Y 8jl0JP1qFPNl0GN5nVS1qD/bGSE9xaHwSwEaNE2znGr+MQuUdYum/uM/knT53Kolzw1z 0t4tF7LZ2qTiepWArlx5iCZjWQpuP0FJUazsbcUaDqudRsHdyqYn4BuFdHHRDDKcE97G YtAomM3yp31lhHgMvW4E9Y0/+ie7L4X6MpLJbC451/7xX+aOfBdsJ39sGiG/yj/qDV0w UVNg== X-Received: by 10.49.2.35 with SMTP id 3mr29145889qer.36.1358912244545; Tue, 22 Jan 2013 19:37:24 -0800 (PST) Received: from [192.168.200.148] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id z16sm12533149qac.19.2013.01.22.19.37.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jan 2013 19:37:23 -0800 (PST) Message-ID: <50FF5AF1.1030406@lerdorf.com> Date: Tue, 22 Jan 2013 19:37:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: Dmitri Ravazin CC: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 1.4.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlwESkZkeJHrO6WM6KGxQBxMWROt8bEUHozW5DuOlLGjzwY4WpF4ma5QP2872wsxcIuVuiz Subject: Re: [PHP-DEV] RE: __init magic method From: rasmus@lerdorf.com (Rasmus Lerdorf) On 01/22/2013 07:20 PM, Dmitri Ravazin wrote: > hey, here's an idea. Let's drop class autoloading 'magic' as well, > because it has all the same 'problems' that you've just described. > It loads things at 'completely arbitrary' times, it's complicated, and > it surely makes reading code 'too hard'. And the gains are 'very > little', anyway. > You can always load your classes manually with a bunch of require > statements, right? It is trickier than autoloading because __init() tries to blur the lines between the compile and execute stages if I read your original email correctly. And we have some magic in the compiler that tries to optimize things and resolve as much of the inheritance chain as possible at compile-time to the point where ZEND_FETCH_CLASS opcodes are NOP'ed away(*). I suppose this could still hang off of the the initial ZEND_FETCH_CLASS for a class, but it would definitely get tricky to determine when this would happen. (*) http://lxr.php.net/xref/PHP_5_4/Zend/zend_compile.c#4444 -Rasmus