Re: [RFC] Nullable Return Type Declaration
| From: | Larry Garfield | Date: | Mon, 18 Apr 2016 16:57:52 +0000 |
| Subject: | Re: [RFC] Nullable Return Type Declaration | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92416@lists.php.net to get a copy of this message | ||
On 4/18/16 3:00 AM, Lester Caine wrote:
On 18/04/16 04:56, Larry Garfield wrote:I am not sure what you're implying by "some people have no appreciation of the usefulness of"... I am well aware of NULL's use cases. I am also well aware that the general zeitgeist in the language development community is that they're dangerous; the designer of the first language to have them calls them a "billion dollar mistake", many languages actively avoid having NULL in favor of something deliberately more structured. NULLs are a very common cause of avoidable fatal errors in many languages (including PHP). NULLs are rude to users of your API, as it balloons the error handling code they need to deal with. I am on record and will continue to be on record that null is *usually* wrong. I consider that position entirely justified, as does the academic CS community. I am also now on record suggesting that we use union types to allow type-or-null returns/parameters, which you're welcome to quote me on. :-) Are you comfortable with the compromise position I've proposed? -- --Larry Garfield2) Doesn't make it quite so easy, which hopefully discourages (but does not prohibit) its usage.This implies that using 'null' is wrong ... and is a slippery slope to then 'disabling' null where some people think it should be removed. If PHP development is making these sort of decisions it should be clear that is the intention, not just 'hopefully discourages' things that some people have no appreciation of the usefulness of!