Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102872 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44163 invoked from network); 16 Jul 2018 22:27:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 22:27:23 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.65 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.65 mail-wm0-f65.google.com Received: from [74.125.82.65] ([74.125.82.65:50808] helo=mail-wm0-f65.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/11-37178-9CB1D4B5 for ; Mon, 16 Jul 2018 18:27:23 -0400 Received: by mail-wm0-f65.google.com with SMTP id v25-v6so16612695wmc.0 for ; Mon, 16 Jul 2018 15:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=d9YdZSapImc7dna74LfXdL1A0s51ngXaXuzVIiCQVxY=; b=Zoocit1qMiPzPZ2MC12PxB6CnpSx8MCogA+lRYOzDPY7OfyrtLKpK8O79y04oRhEzg 3ggrDpnFpuBLilSVmYGNrGASDGis1FyfAGQSpnPwEqmh75fyPSLWGdhmvEzBRu8DHTqj 8ftaFt1QsX9vfqygKvI/okxabaBSzBuLrnMlPQq1kJ/hI+qpgr19I21R0PRuDipRqXQi HisQZC+2RXFGcUkl1c5QwKFCuu9rR29GAu8NmmgiuWiJ9y2v0iV4L2cLDoACf+FYHKwD L5DOASfkUoDuxZGmLLtKs6dy4uN+P7ND+JhtP5Ztje5V/YAfzMD5XTsNfIcrQ0ZGxXNk wOXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=d9YdZSapImc7dna74LfXdL1A0s51ngXaXuzVIiCQVxY=; b=HjnBHbacdwBgDdxHSK+WVs5fR762ARsI24RB9oltnlHzBbSxvToUv+WwUEshnLNcBG sp5W/xxeBmOaPI3KSOT/zwthEMLykgnipIcSaRTqgeD7bUAeKZwmkBc+mKlUs+KJ5oSi +/39KO9U+nLYVRP7ndBxO669/J/W0WhzgCcWzlqVDhYkfeNgcVlpFjW8ClZf3vf1v8lu Z2NsCVGQ+AwfEUEYQIasTHPUvWG555Jw1XN7Dd+pfx7gag9u/A6EqxqNsd0zK+2uHGWA MzFP1/ic5T/DT9NWNy9bI/dLd95IIxki4tY+eRFpRbgoWGv+Mv4NqKqbRuV3nH5LQvRW KoMA== X-Gm-Message-State: AOUpUlFAcPIA/aOjVMb4jZVbCqW20zIN0uquqxShpTwkdEiFjnPAT6o/ 7CWMgrz2MuhiWJaMNg/QauI= X-Google-Smtp-Source: AAOMgpcLGK5jXrYBsZNc5ezMgrdHD2hy5D+ZrE+IltuyBB/YMKwAGvpSgjx25kx2LtYJobfnsi9lLg== X-Received: by 2002:a1c:e708:: with SMTP id e8-v6mr11389804wmh.134.1531780038558; Mon, 16 Jul 2018 15:27:18 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4b86:4b00:1586:91d1:7eb3:56c9? ([2a00:23c4:4b86:4b00:1586:91d1:7eb3:56c9]) by smtp.gmail.com with ESMTPSA id k3-v6sm13203807wme.44.2018.07.16.15.27.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 15:27:17 -0700 (PDT) Date: Mon, 16 Jul 2018 23:27:14 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <4a18eb8b-1271-4f82-6d5e-4f8350084385@gmail.com> References: <8916EC21-D368-40F8-9ABD-CE0C04A73539@gmail.com> <4a18eb8b-1271-4f82-6d5e-4f8350084385@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: Stanislav Malyshev ,Wes CC: PHP Internals Message-ID: Subject: Re: [PHP-DEV] Non-nullable properties From: rowan.collins@gmail.com (Rowan Collins) On 16 July 2018 19:42:49 BST, Stanislav Malyshev wr= ote: >Hi! > >> I agree with you=2E If someone really wants to have an "uninitialized" >field >> on purpose, they should do that using the correct type declaration, >i=2Ee=2E: >>=20 >> ?MyType $myNullable =3D null; >>=20 >> When this was started I asked if it was possible to check types right >after >> object has been constructed, but they said it was inefficient to do >so=2E >> If this is still true, then I'm ok with checking on first access >instead=2E I >> don't want even more overhead from runtime type checking=2E >> This is definitely not as bad as the "billion dollar mistake" though=2E >The >> error still happens, but in a different place=2E > >In Java, avoiding these kinds of errors - when the property is not >initialized - is almost trivial, and that's not what "billion dollar >mistake" is about=2E Lack of initialization for a final value (which is a >frequent case with property values) is detected by the compiler, and >most IDEs/analysis tools would alert of lack of initialization for >non-final value too=2E The problem is with usage on null as a >substitution >for no value/error/unknown value and this value bleeding out into parts >of the code that don't know how to handle this situation=2E Fair enough=2E To avoid us getting sidetracked, I retract my mistaken comparison to the "= billion dollar mistake"=2E It felt like a cute reference to include, but it= didn't really help explain my point=2E However, I stand by my opinion that introducing an error-on-access state f= or properties will lead to more problems than it solves, and that if we can= 't guarantee non-nullable properties are actually non-null, then we shouldn= 't allow them at all=2E Regards, --=20 Rowan Collins [IMSoP]