Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106780 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20737 invoked from network); 29 Aug 2019 01:51:44 -0000 Received: from unknown (HELO mail-qt1-f177.google.com) (209.85.160.177) by pb1.pair.com with SMTP; 29 Aug 2019 01:51:44 -0000 Received: by mail-qt1-f177.google.com with SMTP id z4so1614992qtc.3 for ; Wed, 28 Aug 2019 16:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HE+CeHMBLKZP+dVQPPeWJuPxIkk84aqhnwtjKOUCcQM=; b=fvi18mWiAvVmTzwYY0ZF+Or+RghIgRlahCQJgZP7J+pZ9wUop0bfWBOnhZly/erxCN d2IWy7OJtWzcrqpneIEe+vUBjxfNB8UxH/dJBGSyZLSEgYyZD4hmUiBlZYFxoF0Mwlxn FsiYYtdfdAY9dj8waRUstCHauHHTAZCqSOapDrgWSvZjpQD4GIpEwBi7EJHkk6j4PB96 Aiz/pEDZOha/uHlmsK/tyKD8PrjmzsWQjT59dpcjZIARnnEMFqdtd41hX6rpxJptpf5d X4AQFM/TzegjFAuuI/Uhj76YoG1FtR8sePECzBniCw7fOsHOkXpKPKirYnfyIJlvXmN0 3V8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HE+CeHMBLKZP+dVQPPeWJuPxIkk84aqhnwtjKOUCcQM=; b=ed+P1uAoIAWWeGWH8qsx36rZB1EfQXkynXw6rX33W0FeC/gcW51ClNyzJdHPKr3Td3 PapOTBq0Vi3vq5I8dXXsZinacddYYaJ56LSgaehwCDQiEbBmLvKOHzO0nQ4/yqILiA8f h9l9DNJBEKJvXsOglsUV/qrESFaB12cZHpSydTCyyP8T/YLfkL2QSLBJO8s9I2oxHTl4 03aOtoWS+C1vDkeHMzu6Kc5hdBSjleEnFWwUgNzwn2cCQ1O/Je1ZDZxVDjZgC+VKQ4nW DJcN6eWQQAd8v2k/qEZ0kcZ2oiIYOP0VJCaRPehCE/lrEJKCgPTj+Gh/RZTLVBRYP6LZ QXgA== X-Gm-Message-State: APjAAAU/AaZBg08Ox/jbmA4VkW1aLMgm9dAXxKYSbjfSjSrbZnqZOhZf qsgJEBhZcKwsJ5ifvmaqm3U= X-Google-Smtp-Source: APXvYqyOHEPjiOoLStN3I+JkksMz5Geb5vJAYytgsx+bkS0mc4NwAa8WivJd2vr6nu4rYxYMTzBYEA== X-Received: by 2002:aed:23c1:: with SMTP id k1mr7243795qtc.70.1567034639108; Wed, 28 Aug 2019 16:23:59 -0700 (PDT) Received: from ?IPv6:2600:380:5a55:633c:f923:58b4:dea7:7f90? ([2600:380:5a55:633c:f923:58b4:dea7:7f90]) by smtp.gmail.com with ESMTPSA id h8sm445195qth.84.2019.08.28.16.23.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Aug 2019 16:23:57 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (16G77) In-Reply-To: Date: Wed, 28 Aug 2019 19:23:56 -0400 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <98CDCF47-D262-449B-92BD-1E041A467B21@gmail.com> References: <6ed74ae0-5feb-39de-a39a-f9a8f80401b2@gmail.com> <342BB5DE-80D0-405E-8C71-D959F38D17E8@gmail.com> To: Stanislav Malyshev Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: matthewmatthew@gmail.com (Matthew Brown) $foo++ becoming 1 when $foo is undefined is not intuitive to me. To take a very trivial example, that behaviour causes =E2=80=9Cfor ($i =3D 0= ; $i < 10; $I++) {}=E2=80=9D to loop indefinitely. > On Aug 28, 2019, at 6:52 PM, Stanislav Malyshev wrot= e: >=20 > Hi! >=20 >> This is where I think PHP may have broken us a little. >=20 > I think it's in no way "broken" to be able to easily match expectations, > like $foo++ always do what you meant without clunky boilerplate. > Also, if you think PHP is the only language I program in daily (and I > mean every day, except some weekends and vacations maybe) you're wrong > :) I have something to compare to, so what I say some things are easier > in PHP that's because I actually compared. >=20 >> I just asked a few non-PHP developers here what they expect "(function >> () { $a++; })()" to do, and they agreed it would be some sort of error. >> Got the same answer for "(function () { $a->bar =3D 5; })() ". >=20 > I see absolutely no reason for it. Maybe if you're a Java programmer who > never saw non-statically-typed non-B&D language - but that's not a > virtue we should be striving to emulate. If we have a tool that already > does things better and some people don't even know such tools are > possible, we should educate them, not break our tools so it would be > more comfortable fit to their experience. >=20 >> Indeed, anyone who's used another C-like language (JS, TS, Java, C# etc) >> is used to these things being errors, so it can be disorientating to see >=20 > I don't think having things just work instead of usual boilerplate that > you have to declare everything upfront and repeat even obvious things > numerous times is "disorienting" in any way. If you check how languages > that are alive evolve (like Java or C++, C is mostly fossilized these > days), even strict ones, you see they support more and more intuitive > approaches - like auto variables for example - which make things easier. > Because human should spend time thinking, not figuring out how to > satisfy a dumb compiler. That's the direction we should be moving to. > Not adding more errors and boilerplate in clear cases like $foo++. >=20 > --=20 > Stas Malyshev > smalyshev@gmail.com