Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84823 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77587 invoked from network); 15 Mar 2015 13:00:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2015 13:00:59 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:58939] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/E7-29489-98285055 for ; Sun, 15 Mar 2015 08:00:58 -0500 Received: from [192.168.0.101] ([91.67.244.80]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MLR30-1YXg7r0WlW-000bKY; Sun, 15 Mar 2015 14:00:53 +0100 Message-ID: <55058284.9080908@gmx.de> Date: Sun, 15 Mar 2015 14:00:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Philip Sturgeon , Arvids Godjuks CC: =?UTF-8?B?UGF2ZWwgS291xZlpbA==?= , Anthony Ferrara , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:ChgOigbyqOjT0EP2PCe5ona1y0L0qlrkK3RyQpAFmX0CPVuxMDK F4MzuedRU1asuv1a6RJZ9+iI4Kimnhv5+PfXt9Y+zk/RJeZPo3CXyGcjsUuW2Tmeew1TWNF jLrdI3bcicLy5yaJKpIdckOpHSRoZUptEV6GZalFUdFSnczxalHOOLt3wy+cJenbtdK5RDo kOQ3W8rH9Wa2kahOx4k5Q== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [PHP-DEV] A plea for unity on scalar types From: cmbecker69@gmx.de (Christoph Becker) Philip Sturgeon wrote: > On Sat, Mar 14, 2015 at 7:19 PM, Philip Sturgeon wrote: >> On Fri, Mar 13, 2015 at 7:02 PM, Arvids Godjuks >> wrote: >>> >>> >>> пт, 13 Мар 2015, 23:01, Philip Sturgeon : >>> >>>> Pavel, >>>> >>>> On Fri, Mar 13, 2015 at 3:38 PM, Pavel Kouřil wrote: >>>>> On Fri, Mar 13, 2015 at 4:45 PM, Anthony Ferrara >>>>> wrote: >>>>>> >>>>>> But for today, I firmly believe that the Dual-Mode proposal is the >>>>>> only one that stands a chance of passing. I think it's the best chance >>>>>> for the language, and it's the only one that tries to unite the >>>>>> different usages of PHP into a single group, rather than alienating >>>>>> users. >>>>>> >>>>> >>>>> Hello, >>>>> >>>>> I see (as a userland developer) these problems with dual mode: >>>>> - It is a "setting" that changes the language's behavior; I don't >>>>> think that it matters whether or not it would be an INI setting or the >>>>> declare() one, because both of them are bad. >>>>> - It does not "unite different usages of PHP into a single group"; it >>>>> does exactly the opposite, splitting PHP usage into TWO groups. >>>>> - Once this dual mode would be introduced to PHP, there would probably >>>>> be no way of removing it later without massive BC break, once most >>>>> people would realize that it is really awful to have it in the >>>>> language. >>>>> >>>>> (There's probably more of them, but these are the biggest issues I >>>>> currently have.) >>>>> >>>>> Regards >>>>> Pavel Kouril >>>>> >>>>> -- >>>>> PHP Internals - PHP Runtime Development Mailing List >>>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>> >>>> >>>> Hang on. This is not the time to nitpick things in various RFCs that >>>> have already been answered time and time again. >>>> >>>> An ini setting would be insane because taking an app that works on one >>>> machine and putting it on another would completely break the app. >>>> Hello anything using Composer, hello any CMS, hello any system moving >>>> to a new host that doesn't let you change ini settings, or you dont >>>> know how. >>>> >>>> A declare statement in the top of the file changing how that file >>>> handles things is hardly a problem, and is exactly how a lot of other >>>> languages do things. Hello JavaScript. >>>> >>>> It seems like you didn't read anything now you're just saying "it's >>>> bad" a lot. Please don't do that. >>>> >>>> -- >>>> PHP Internals - PHP Runtime Development Mailing List >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>> >>> That declare thing with the removal of block-aware declare(){} kills one of >>> the fundamental optimizations you can do for large PHP projects - compacting >>> most used files into one single big file and caching it. And you never had >>> to care what the files are - just splice it all together and let autoload >>> handle the rare cases. With single declare statement I effectivly have to >>> scan all the code, remove declare statements and choose a mode globally. >>> Well, it might work for a small project, but in a big project with multiple >>> teams or even multiple vendors doing different parts.... >>> >>> At this point I have only swearing words for the proposing persons and >>> supporters. >>> It's magic_quotes and register_globals all over again, but this time you >>> can't fix it with some PHP code. >>> >>> You really had to fuck it all up for us, the userland developers, didn't >>> you? >>> >>> Sorry, but I now question the wisdom and sanity of most new PHP folks. >>> Because the old once see the danger and vote "no". And everyone just thinks >>> they act up. Well, you wrong. I will nit be surprised if they just leave the >>> project for good after this. >> >> >> Wow, that's a lot of rage over nothing. Here, I got you a gift: >> >> foreach (new DirectoryIterator('./src/**/*.php') as $fileInfo) { >> $fileContents = file_get_contents($fileInfo->getFilename()); >> >> if (strpos($fileContents, 'declare(strict_types=1') !== 0) { >> $fileContents = str_replace("declare(strict_types", "# >> declare(strict_types", $fileContents); >> file_put_contents('./compiled/weak.php', $fileContents, FILE_APPEND); >> } else { >> file_put_contents('./compiled/strict.php', $fileContents, FILE_APPEND); >> } >> } >> >> Tadaaaaaaa. >> >> Phil Sturgeon. Problem solver. Fixer of the bad day. Userland Ninjitsu. :) > > I would like to appologize for my previous email. .. > > It contained quite a serious oversight. > > if (strpos($fileContents, 'declare(strict_types=1') !== true) { > > That's better. Wouldn't the condition be always true in this case? Testing for === false seems to be more appropriate. -- Christoph M. Becker