Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97839 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55796 invoked from network); 17 Jan 2017 22:03:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2017 22:03:32 -0000 Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.41 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.213.41 mail-vk0-f41.google.com Received: from [209.85.213.41] ([209.85.213.41:32825] helo=mail-vk0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/CF-00729-3B49E785 for ; Tue, 17 Jan 2017 17:03:31 -0500 Received: by mail-vk0-f41.google.com with SMTP id k127so56249625vke.0 for ; Tue, 17 Jan 2017 14:03:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=bV8b3ayhqzpp39jMP8UU3jGXcyg6qVDsfw3lnfBxmSc=; b=YInKJO3KpVyRQZTETTbWxAN32QeppMhdjAufkbfuBw55IHJRg1y8XRA3rqwnr+6G4E mudGdlmf/E//gwN5CVfB6qizR161LDKeW5+SZroL+qOaUkMvEV0QnqFn0b7N0sPUnN2G CT4sDWONsTj6rgW7eUizltuFAPU5rLS04NSNEl2qeEW1Wyy5+nJWxUWTxd3XqvSXRv2C 4wcXj4gKmrQXrRBbmXDSFaJeAqY1osoWIE6SEbJ9ydo149k4jw8LHp1xK8LuBRiwiHlK 9UVqdqFlq7Z4/xAuR16HUkXKUnINPnXPnrY+djVNE0UUP63L47th+bPPbZ41Cs2J5uX0 g/aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=bV8b3ayhqzpp39jMP8UU3jGXcyg6qVDsfw3lnfBxmSc=; b=Y4sxLA6SwvpGh9s8z+zqrtAqz2USrw8yaBbhc9+kIuYzAYIVbF46EpYam1tASJ1uSu vTGETbhfZi++Ef4s+09Lk0lRdqJQxyHy8mIl70p2VIvsRFTMXtJKOK0xS75k69BZVguM uHi4Liv3+DNQwvwi1uPsN18n+OE5nCsJPnTZRitMzdThVS8FnqbO/OEzmzPXYxo7gWpp e5smAOHjaWKjONIw2q71hnnYBMLRrj9jCvfHAj6iXEjrvyfqOwPJhKIQb/AnaUJl1Pnq d4NhadcO/siwQPjMrfdFBCirKov8Fv1ZdpCX0FlPzw74jjHr1bflXhGH+fGUsv1sBrhr kZmQ== X-Gm-Message-State: AIkVDXIktrnwy4pioOlGK4EU8OYshDDTIT0tEO7zvFMyX7C3GU1XSCGlVrz2cykevkQvdS0p+SL6t6Zm3K+ZLw== X-Received: by 10.31.242.11 with SMTP id q11mr20107090vkh.54.1484690608255; Tue, 17 Jan 2017 14:03:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.35.15 with HTTP; Tue, 17 Jan 2017 14:03:27 -0800 (PST) In-Reply-To: References: Date: Tue, 17 Jan 2017 17:03:27 -0500 Message-ID: To: PHP internals list Content-Type: multipart/alternative; boundary=94eb2c14c2684e78e00546517898 Subject: Re: [PHP-DEV] Typed properties problems From: tendoaki@gmail.com (Michael Morris) --94eb2c14c2684e78e00546517898 Content-Type: text/plain; charset=UTF-8 On Tue, Jan 17, 2017 at 4:52 PM, Stanislav Malyshev wrote: > Hi! > > > That's pretty messed-up right there. At least in the object cases there's > > an E_WARNING "Creating default object from empty value" - with the array > > case, nothing, it just converts your boolean into an array. Yiiiiikes. > > You told PHP you want an array, you get an array. > > Exactly. Scalars can change datatypes without warning. That's powerful, but also migrane inducing when not used properly. I taught myself PHP. For the first two years I had no real grasp of the significance of datatypes, and it would be another two before I felt a need to want to control datatypes. Strict datatyping makes a language harder to use for beginners. Loose datatyping can make debugging harder on veterans. For that reason PHP should ideally be able to do both. A step in that direction was taken in 7 with the strict type declarations for function arguments and returns. Applying this to properties would be nice, but the coercion rules for situations like Stanislav gave are going to be difficult. --94eb2c14c2684e78e00546517898--