Re: C# properties vs. accessors RFC
| From: | Crypto Compress | Date: | Thu, 24 Jan 2013 13:45:06 +0000 |
| Subject: | Re: C# properties vs. accessors RFC | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65147@lists.php.net to get a copy of this message | ||
Am 24.01.2013 02:12, schrieb Levi Morrison:
Hello Levi, you absolutly right. I was confused by the syntax. This properties are normal methods and should behave the same. Mixing "initialize-with-NULL" and "optional/nullable" is somewhat messy though. cryptocompressFor properties, yes, but the idea it stems from is type-hints. Given the following type-hint, passing a null is not allowed:I also don't like theThere is no such PHP convention. The PHP convention is *not restrict type* (+"loosely typed" addons). So NULL is automatically allowed.?fornullable. Just stick with PHP convention and do:class Foo { public Bar $bar = NULL; }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.