Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84791 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93356 invoked from network); 14 Mar 2015 23:51:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2015 23:51:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=pjsturgeon@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pjsturgeon@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: pjsturgeon@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:34091] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/E1-13042-D99C4055 for ; Sat, 14 Mar 2015 18:51:57 -0500 Received: by lagg8 with SMTP id g8so14703060lag.1 for ; Sat, 14 Mar 2015 16:51:54 -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:content-transfer-encoding; bh=5wBkGjZ1B0+F+b6XjqM3p9+uX1MezIbCgNhSeGPytSs=; b=yWM5E1IsgQBMZRGuGZQDDZwF9TQIUZMKtujzberPbhtwlYxhsbVWYTQtjnGHGpVW3V jgXlZUpBIb2ToZ8BJfZ/ZWLL2V/lPjLPex9qrvbl1E7n6nFITEBVAHc+U733ZJpDvXgD eQhZBkfiDLxdweOTSAXKbuSG7l5U/GYQPh6Dmam5AWqRE3jEtziAeGUu6j27x/kPmn6J EWLicbXP7FyTNZbzWUq9hsyL3LMpgq6/HEc42KNMO1u7HrRYsMim2pEFNbrbHUWkbs2v /fms7UKZulBm4cfhDbyILBWD7shmvzThJ13ZirR6M0geGOLQh++GRf9BSfKFk5+6Z39a TBrA== MIME-Version: 1.0 X-Received: by 10.152.23.133 with SMTP id m5mr23912245laf.71.1426377113907; Sat, 14 Mar 2015 16:51:53 -0700 (PDT) Received: by 10.114.26.34 with HTTP; Sat, 14 Mar 2015 16:51:53 -0700 (PDT) In-Reply-To: References: Date: Sat, 14 Mar 2015 19:51:53 -0400 Message-ID: To: Arvids Godjuks Cc: =?UTF-8?Q?Pavel_Kou=C5=99il?= , Anthony Ferrara , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] A plea for unity on scalar types From: pjsturgeon@gmail.com (Philip Sturgeon) On Sat, Mar 14, 2015 at 7:19 PM, Philip Sturgeon wro= te: > On Fri, Mar 13, 2015 at 7:02 PM, Arvids Godjuks > wrote: >> >> >> =D0=BF=D1=82, 13 =D0=9C=D0=B0=D1=80 2015, 23:01, Philip Sturgeon : >> >>> Pavel, >>> >>> On Fri, Mar 13, 2015 at 3:38 PM, Pavel Kou=C5=99il = 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 chan= ce >>> >> 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 th= e >>> > 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 probabl= y >>> > 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 - compac= ting >> most used files into one single big file and caching it. And you never h= ad >> to care what the files are - just splice it all together and let autolo= ad >> handle the rare cases. With single declare statement I effectivly have t= o >> 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 multi= ple >> 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 thi= nks >> 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 =3D file_get_contents($fileInfo->getFilename()); > > if (strpos($fileContents, 'declare(strict_types=3D1') !=3D=3D 0) { > $fileContents =3D 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_APPE= ND); > } > } > > 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=3D1') !=3D=3D true) { That's better.