Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91746 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20217 invoked from network); 18 Mar 2016 10:56:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2016 10:56:06 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.44 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.213.44 mail-vk0-f44.google.com Received: from [209.85.213.44] ([209.85.213.44:35390] helo=mail-vk0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/01-13075-3CEDBE65 for ; Fri, 18 Mar 2016 05:56:05 -0500 Received: by mail-vk0-f44.google.com with SMTP id e6so136382109vkh.2 for ; Fri, 18 Mar 2016 03:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QrvRbQzXsrGa4+Z5b8JD2HUFee4dJr2+Vk0o8BXayPA=; b=bCB4SO2VADgWRS4Yi7BeOskGaOJYB5ArC76BLklO36uCugC//yETbDTyBgUFPBVtdi JLZjjSZsQNvG6QmpCED9W6D7rFyRDiQKHk7791tSlXhk9wkI8F10j6ccDkUucbbJfxA2 h9SW/og/8AS46kqrbX8tu2V4q4Wob+LbNqgb75SVf2Mohk35S1fTiFPevlTIpGaqBf+t 7zPnclru1ZFr+T7i+3H5nfnLyEJQxme70wnvkokOR/yyYD7N33Idh8s2vdjjcN2kVvWf GaJmqMX27U+SgR4REWxJtufmVi051ShArJZd5rv7dU5KPPXcqLkUyR8fcoDOvegXDDkH trSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QrvRbQzXsrGa4+Z5b8JD2HUFee4dJr2+Vk0o8BXayPA=; b=Hco+A3FVIHSenTbdL+iTvBg7jDmUtYnJtzjwP955AMsMJ3nf6ty+7ow4FrbaMrkN/T LONpUKDXh3nBIimqfE+h/dKuAyw8lcmiXRUbBzzg6AsAYVL18CSnzcx5gs7R6xqu8acu 2nXQE/m72lQSddd7ecIvixacrLafHz4OciiJtIRLE4LKqWGW5+/gahq2Kwyzcjm7T2eK bqPCj2OpGOwkXvQr70QcvtFTkYEetH6XSrMEoAyaH9/1gPLAsLH7M2at7pFbS93M1EN2 ZlmOHw+YZXdoLasUE0wlLN8srCrhPsceQcvk9or7wCMlAEOxyLMJxrgxofhRFy+NhY4W hJJg== X-Gm-Message-State: AD7BkJId9Hpdzvtz+jjO9KcUkrlUvc0jt3Oxdu7GypscWOGwsJ8QmE1DoLmZ1rgIw1hZkdeDSrEY+No1i4GT8g== X-Received: by 10.31.21.4 with SMTP id 4mr16323137vkv.151.1458298560442; Fri, 18 Mar 2016 03:56:00 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.159.35.77 with HTTP; Fri, 18 Mar 2016 03:55:20 -0700 (PDT) In-Reply-To: References: <56EA8EA9.80905@mprelu.de> Date: Fri, 18 Mar 2016 19:55:20 +0900 X-Google-Sender-Auth: _Ej0fkYMbF6omU0Vs3q8Uyh2PiA Message-ID: To: Andrey Andreev Cc: Matt Prelude , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi, On Thu, Mar 17, 2016 at 8:46 PM, Andrey Andreev wrote: > I'd support borrowing the "?" nullable annotation from HackLang for >> people who want a less strict behavior: >> >> public ?string $name; >> >> This means that $name can either be a string or the NULL value. >> > > Or, do it like with parameter type hinting: > > public string $name = null; > > Although I'm all for limiting NULL to only being the default value: > > $this->name = null; // this should throw a TypeError NULL is special type. '' and NULL is different entity. class User { public string $username = NULL; } After authentication $username could be "yohgaki". What is should be after logout? $username = '' does not make sense, but $username = NULL. There are ways to work around this, but property cannot be NULL is problematic. IMO. class User { public string|null $username = NULL; } may work. I'm not sure if this is good idea in general. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net