Re: C# properties vs. accessors RFC
| From: | Levi Morrison | Date: | Thu, 24 Jan 2013 01:12:54 +0000 |
| Subject: | Re: C# properties vs. accessors RFC | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65138@lists.php.net to get a copy of this message | ||
>> I also don't like the
? for
>> nullable. Just stick with PHP
>> convention and do:
>>
>> class Foo {
>> public Bar $bar = NULL;
>> }
>
>
> There is no such PHP convention. The PHP convention is *not restrict type*
> (+"loosely typed" addons).
> So NULL is automatically allowed.
For properties, yes, but the idea it stems from is type-hints. Given
the following type-hint, passing a null is not allowed:
class Foo {
function bar(Bar $bar) {}
}
Whereas in the following NULL is allowed:
class Foo {
function bar(Bar $bar = NULL) {}
}
This is what I mean by the PHP convention for allowing NULL.