Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68546 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93124 invoked from network); 16 Aug 2013 07:43:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Aug 2013 07:43:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=bof@bof.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bof@bof.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bof.de designates 80.242.145.70 as permitted sender) X-PHP-List-Original-Sender: bof@bof.de X-Host-Fingerprint: 80.242.145.70 mars.intermailgate.com Received: from [80.242.145.70] ([80.242.145.70:59226] helo=mars.intermailgate.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B6/DF-06453-908DD025 for ; Fri, 16 Aug 2013 03:43:05 -0400 Received: (qmail 19427 invoked by uid 1009); 16 Aug 2013 09:43:01 +0200 Received: from 209.85.212.45 by mars (envelope-from , uid 89) with qmail-scanner-1.25-st-qms (clamdscan: 0.96.2/17688. spamassassin: 3.3.1. perlscan: 1.25-st-qms. Clear:RC:1(209.85.212.45):. Processed in 0.077947 secs); 16 Aug 2013 07:43:01 -0000 X-Antivirus-MYDOMAIN-Mail-From: bof@bof.de via mars X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:1(209.85.212.45):. Processed in 0.077947 secs Process 19416) Received: from mail-vb0-f45.google.com (gmail@bof.de@209.85.212.45) by mars.intermailgate.com with RC4-SHA encrypted SMTP; 16 Aug 2013 09:43:01 +0200 Received: by mail-vb0-f45.google.com with SMTP id e15so1363363vbg.18 for ; Fri, 16 Aug 2013 00:43:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NtW4zMP26+THHxUWNB4UoDHjYKTPx/NoNWJKEmkpV2U=; b=Fi7Lhn+G8I+MZfse5iUqftEcbEuOnY6vez1OrinAZkeTB0U6gty84osAIGlIAQ5Mi5 WChsZLYMhU+Jat2vPJjUzzMYirS4FHBzCxW23Q2goyh3WK2+riOek0pjqf8FAp43aEne BhkPIJfiR6aL/sHYr9SgHnwuL+1KczBetiJAAc5BTXGJDe45swqxg9htZS5V1f5wUlhB 7GSu/PfnX+wD9v4I3xW6yGKeRw9uHoe5QYvvChMKo8mdvg1LTy6jZ0mWdpQZSdt1L1vv bhI34+CHzFiFxPzcZCn3vbHOSXf3AWZggUUtgZODIblPFJDuvfnSGgDLVcf7qvSRwUe0 DH8A== MIME-Version: 1.0 X-Received: by 10.58.237.105 with SMTP id vb9mr97597vec.2.1376638980279; Fri, 16 Aug 2013 00:43:00 -0700 (PDT) Received: by 10.52.240.49 with HTTP; Fri, 16 Aug 2013 00:43:00 -0700 (PDT) Received: by 10.52.240.49 with HTTP; Fri, 16 Aug 2013 00:43:00 -0700 (PDT) In-Reply-To: <520D6758.4050500@sugarcrm.com> References: <520B4772.8090701@sugarcrm.com> <520BBA89.1090208@sugarcrm.com> <520D6758.4050500@sugarcrm.com> Date: Fri, 16 Aug 2013 09:43:00 +0200 Message-ID: To: Stas Malyshev Cc: Julien Pauli , internals , Sebastian Krebs , Derick Rethans , Anthony Ferrara , Sara Golemon Content-Type: multipart/alternative; boundary=089e01294a5067561c04e40bbd33 Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions From: bof@bof.de (Patrick Schaaf) --089e01294a5067561c04e40bbd33 Content-Type: text/plain; charset=ISO-8859-1 Am 16.08.2013 01:42 schrieb "Stas Malyshev" : > > But this is not the most tricky part. The most tricky part is this: > if(true) return; > class Foo { > const halfpie = M_PI/2; > } > > Now what happens if this is implemented as an opcode? We can't run any > opcodes past return statement, but Foo is expected to be defined here. Couldn't the opcodes for such behind-the-scenes initialization be generated as the first thing of the '(main)' opcode stream, so that they would run before it comes to the "if (true) return;" ? Once that is in place, make classes have an optional on-first-use opcode stream, too: - emit calls to that in the file's up-front opcode stream for each locally defined class that has them - in that per-class initializer stream, expression evaluation even for non-constant initializers (protected $foo = anything::whatever()*10;) could be put - and also a call to the much talked about static class initializer function - all in strict definition order, with fallout related to interdependance left to confuse class authors :) best regards Patrick --089e01294a5067561c04e40bbd33--