Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88250 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17550 invoked from network); 16 Sep 2015 17:07:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2015 17:07:14 -0000 Authentication-Results: pb1.pair.com header.from=rewilliams@thesba.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rewilliams@thesba.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain thesba.com designates 208.106.205.210 as permitted sender) X-PHP-List-Original-Sender: rewilliams@thesba.com X-Host-Fingerprint: 208.106.205.210 ntsexchedgea1.newtekemail.com Received: from [208.106.205.210] ([208.106.205.210:55316] helo=NTSEXCHEDGEA1.nts.phx1) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/32-04557-FB1A9F55 for ; Wed, 16 Sep 2015 13:07:12 -0400 Received: from NTSMAILBOX2.NTS.PHX1 (208.106.205.233) by NTSEXCHEDGEA1.nts.phx1 (208.106.205.210) with Microsoft SMTP Server (TLS) id 15.0.847.32; Wed, 16 Sep 2015 10:06:39 -0700 Received: from NTSMAILBOX1.NTS.PHX1 (2002:d06a:cde8::d06a:cde8) by NTSMAILBOX2.NTS.PHX1 (2002:d06a:cde9::d06a:cde9) with Microsoft SMTP Server (TLS) id 15.0.847.32; Wed, 16 Sep 2015 10:06:32 -0700 Received: from NTSMAILBOX1.NTS.PHX1 ([fe80::51f0:160d:841f:d989]) by NTSMAILBOX1.NTS.PHX1 ([fe80::51f0:160d:841f:d989%13]) with mapi id 15.00.0847.030; Wed, 16 Sep 2015 10:06:32 -0700 To: Rowan Collins CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? Thread-Index: AQHQ36zP6Wb5e1HnokKnJlazAkejtZ4eJ62AgABxe4CAAAPLgIAAJlKAgAAUa4CAACGZAIAAGymAgAjS3QCAAJOjgIAA+D+AgAA5fACAB+afgIAB6WsAgAFo8ICAACyWAIAHac+AgAAGeYCAAD+qgIAAAnkAgABF9ACAAAG1gIAAJ92AgAKBMwCAAEStAA== Date: Wed, 16 Sep 2015 17:06:31 +0000 Message-ID: References: <55DDA4C9.9040603@gmail.com> <3C69BF4B-52E6-4D04-8601-8D23DFCC538E@craigfrancis.co.uk> <55DDD60F.5090509@gmail.com> <8C74463E-DBA2-4015-8159-0B44D973387F@craigfrancis.co.uk> <55DE0907.6040904@gmail.com> <1F615BCD-1B9B-4C51-A210-869F1AA1F6E3@craigfrancis.co.uk> <55E5EBBF.6020803@gmail.com> <0BA3A129-D356-4781-B6DE-E2B5A7924AE2@craigfrancis.co.uk> <55E6EC36.6090301@gmail.com> <9AF329EC-99A5-412D-A52B-432627A5520F@gmail.com> <6F4D91EE-B56E-4B83-B1AF-598C3F6897FC@craigfrancis.co.uk> <55F07BA4.2000204@gmail.com> <55F6B911.9080400@gmail.com> <96BE7F01-D04B-483B-B1A3-B45CED6DFCDC@craigfrancis.co.uk> <55F6F08C.1020506@gmail.com> <0BEF6D82-CB5F-49F6-A3A4-3267924A0CDA@thesba.com> <55F72CA9.2060301@gmail.com> <09369945-76FE-4E08-9C2C-15FB0577AD27@thesba.com> <55F967FA.7070102@gmail.com> In-Reply-To: <55F967FA.7070102@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [172.16.153.36] Content-Type: multipart/signed; boundary="Apple-Mail=_97C41D18-83E0-45C2-A998-E0CD050B5A4A"; protocol="application/pgp-signature"; micalg=pgp-sha512 MIME-Version: 1.0 Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: rewilliams@thesba.com (Robert Williams) --Apple-Mail=_97C41D18-83E0-45C2-A998-E0CD050B5A4A Content-Type: multipart/alternative; boundary="Apple-Mail=_6F136C88-6A9B-4CF7-9B3C-2F1CD5408B2B" --Apple-Mail=_6F136C88-6A9B-4CF7-9B3C-2F1CD5408B2B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Sep 16, 2015, at 06:00, Rowan Collins = wrote: >=20 > Absolutely. However, in order to need a dynamic check of variable = existence, you must also be using non-existence as a second sentinel = value. You must be saying "if the variable has never been assigned to, = that means state X; if it's been assigned a null value, that means state = Y". My argument is that using undefined variables like that is a bad = choice of sentinel value, and if you need more than one sentinel value = in the first place, you probably need a more complex data type (a = struct-like object with separate state and value properties, for = instance). I agree it=92s bad practice to use =93undefined=94 as a valid sentinel = =93value", but it=92s something that needs to be checked in error = handling sometimes. As an example, go back to template systems that just = define a bunch of variables within the view=92s scope: the view code = needs to verify that it actually got needed variables before it uses = them so that it can fail gracefully if it didn't. This is just defensive = programming, not bad architecture (at least on the view=92s part=85), = and while it can be avoided by having the template system use arrays or = objects, if you don=92t control the template system as the view writer, = then you work with what you=92re given. -Bob --Apple-Mail=_6F136C88-6A9B-4CF7-9B3C-2F1CD5408B2B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252
On Sep 16, 2015, at 06:00, Rowan Collins = <rowan.collins@gmail.com> wrote:

Absolutely. However, in = order to need a dynamic check of variable existence, you must also be = using non-existence as a second sentinel value. You must be saying "if = the variable has never been assigned to, that means state X; if it's = been assigned a null value, that means state Y". My argument is that = using undefined variables like that is a bad choice of sentinel value, = and if you need more than one sentinel value in the first place, you = probably need a more complex data type (a struct-like object with = separate state and value properties, for instance).

I = agree it=92s bad practice to use =93undefined=94 as a valid sentinel = =93value", but it=92s something that needs to be checked in error = handling sometimes. As an example, go back to template systems that just = define a bunch of variables within the view=92s scope: the view code = needs to verify that it actually got needed variables before it uses = them so that it can fail gracefully if it didn't. This is just defensive = programming, not bad architecture (at least on the view=92s part=85), = and while it can be avoided by having the template system use arrays or = objects, if you don=92t control the template system as the view writer, = then you work with what you=92re given.

-Bob
= --Apple-Mail=_6F136C88-6A9B-4CF7-9B3C-2F1CD5408B2B-- --Apple-Mail=_97C41D18-83E0-45C2-A998-E0CD050B5A4A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJV+aGWAAoJEFBTSdRZ0ub3KIQP/3r24hISCyZa2tSeBQK16rcD JJs5cKpGpXUeXKBw6VXbtg3vDvOmP5aFFQxUzxs5D989/OKNZa2N6Mn3OnrKZqDh aZcSheV0YihSX8D072jnzM0TG+DoLRstPDJqTPPzUFGWuwxjFSxjm6niPQBSzqmX mKrLwVDo2rl8W8RkEM8DpUpA+IUFyUXprqIyl85nHzSpdQM2AnRVQRNjvL4xVyAi Y9gs8iOshjEQbWZUy5e+s+pueVodqVxOdvCN8z5i3Oh4QJYrsQ9yBhnrmWL5ZpmM 1mXvGP2+0QklCA0VDdHbnJU0c5V6MkBCJjOVshI+6x7a7aGXjWHfijWnjBgLTwly KYy8UqeXR8BXcsfw+Y3plgqJZw46CqC/ya6q4jft1wTCinTDlOyx0YugKsewMdgB 7l8LNEA3YhXGRI+2JBGYYw8S/I9dz6C91b18TcVvCQnYwHGbEhKb/WOuKPJnBuDt IuKr27FwXESGsifpHUTKXOChmuEmn/H0jSD4mPz7trKPAJuwrxmGF2xqv96Rir/G r6FGvidq9AmLZKpYVG8LOgr8Y2+u64xzv781zKLequPxkO4AEoc+mH6+zraS7Y+M Peb4dVQJwbSH5IafmZ5FZZ8E5ylt8vOcqGWbl3v6cuSvkrYMQDacJvVFuVRtUp4Y JvZWkxA4/womFOjGXpRk =f623 -----END PGP SIGNATURE----- --Apple-Mail=_97C41D18-83E0-45C2-A998-E0CD050B5A4A--