Re: [RFC Discussion] Typed Properties
| From: | Rowan Collins | Date: | Tue, 22 Mar 2016 15:09:23 +0000 |
| Subject: | Re: [RFC Discussion] Typed Properties | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91849@lists.php.net to get a copy of this message | ||
Björn Larsson wrote on 22/03/2016 15:04:
Hm... In Hack the above code works, see: https://3v4l.org/nsA5W Well they have a different implementation as mentioned in the RFC, so no wonder. But they do have typed porperties in the language.It's not just a different implementation, it's a completely different feature - there's no actual type checking at runtime, the type hint is more like an annotation for use with static analysis tools. See https://3v4l.org/ntCr7 which happily assigns int(6) to the "typed property" in HHVM, but is detected by the RFC branch. (Incidentally, I note the TypeError's message is missing the variable name; I presume that's either a known issue or an out-of-date build on 3v4l?) Regards, -- Rowan Collins [IMSoP]