Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68504 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1108 invoked from network); 14 Aug 2013 07:37:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2013 07:37:44 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.46 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:34247] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/AF-06453-8C33B025 for ; Wed, 14 Aug 2013 03:37:44 -0400 Received: by mail-la0-f46.google.com with SMTP id eh20so6570827lab.19 for ; Wed, 14 Aug 2013 00:37:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1uLgxm49crOl3yHgOKBRxiBCpPMoEK4mer0LLkCyT/U=; b=Vrw5rHBgsDme7qI0ml+1hBfOCeTdf6n80oYSJKJJ+K6+xsd7tfnTS9FmDcDFJZMYf+ IKSkeFZtRq7PO9eclGtfIMTjtmEHxoTP26LjtFDqDNTM7P0JaZTLVLUobnIcTVEar+7F i2eeu7YBL6j+8rUq6lTV+lFffF6QTNTXw88k9zWPnuyrfvkd5nHg2aJ9KrynFmw0ISXN Nzg75Kx0Tv0KJjzy6hU2OqRqOjBR020RY1zdkK6n+Xz/V9PjgRCLxq5t1BvrhI41Rion WypB/DlUOsjgkFKkUD77ekr7RenLVU8oE6R2xQgpew5qEbQzHDOYyEUGoA9EYFpY62FV zkHw== MIME-Version: 1.0 X-Received: by 10.112.200.135 with SMTP id js7mr6974087lbc.12.1376465861543; Wed, 14 Aug 2013 00:37:41 -0700 (PDT) Received: by 10.112.1.4 with HTTP; Wed, 14 Aug 2013 00:37:41 -0700 (PDT) In-Reply-To: <4ED7146272E04A47B986ED49E771E347BB514EEE88@Ikarus.ameusgmbh.intern> References: <4ED7146272E04A47B986ED49E771E347BB514EEE88@Ikarus.ameusgmbh.intern> Date: Wed, 14 Aug 2013 09:37:41 +0200 Message-ID: To: Christian Stoller Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions From: pierre.php@gmail.com (Pierre Joye) On Wed, Aug 14, 2013 at 8:17 AM, Christian Stoller wrote: >> Hello all, >> >> I'd like to propose a new RFC for 5.NEXT: >> >> https://wiki.php.net/rfc/const_scalar_expressions >> >> This allows for defining constant expressions which are resolved at compile >> time. > > What should that be for? > >> const FOO = 1 + 1; >> const BAZ = "HELLO " . "WORLD!"; > > Why not just writing > > const FOO = 2; > const BAZ = "HELLO WORLD!"; > > I think it makes code les readable. And if you want to give an important hint for the reader of the code, you can still write comments. When a constant is based on a complex formula, it makes a lot of sense to keep it as it is defined or known. I had many projects (finance, stats and BI related areas) where I would have used constant expressions. As you suggested comments work fine, but do you know what my comments were? The expressions used to generate the constant, sounds double with little to no gain to me. Summary: huge +1 on that. -- Pierre @pierrejoye | http://www.libgd.org