Re: 'Uninitialized' creates a lot of cluttering
| From: | Rowan Tommins | Date: | Sun, 12 Feb 2023 17:47:32 +0000 |
| Subject: | Re: 'Uninitialized' creates a lot of cluttering | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119531@lists.php.net to get a copy of this message | ||
On 12 February 2023 11:11:31 GMT, Lydia de Jongh <flexjoly@gmail.com> wrote:
>The features of a programming-language should not be about preventing
>mistakes, imho.
What is the point of marking the type of a property, other than to prevent mistakes?
>For me it is about the cluttering in an otherwise clean property list.
It's only "clutter" if you don't think it conveys useful information, and
that's obviously a matter of opinion.
>And I think that implicit null on nullable properties could fit nicely
>here. For null is a valid value for a nullable.
For a type of ?int, null is indeed a valid value; but so is 0, and -1, and so on. Why should the
language assume that one default, among all the possibilities, if you don't specify any?
Regards,
--
Rowan Tommins
[IMSoP]