Re: [RFC Discussion] Typed Properties

From: Date: Wed, 16 Mar 2016 17:23:52 +0000
Subject: Re: [RFC Discussion] Typed Properties
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-91696@lists.php.net to get a copy of this message
On Wed, Mar 16, 2016 at 12:49 PM, Will Fitch <willfitch@php.net> wrote: > > > On Wed, Mar 16, 2016, at 11:36 AM, Phil Sturgeon wrote: >> Hello everyone, >> >> I have completed the draft for an RFC, to add Typed Properties. The >> patch has been written by the one and only Joe Watkins. >> >> https://wiki.php.net/rfc/typed-properties >> >> I would really appreciate constructive feedback on this RFC, with a >> few areas especially: >> >> 1. How scared are we that integers can be expanded to floats on runtime? > > First, this looks awesome, Phil! > > After reading through it, I think we can consult with function return > types: > > function blah() : int { > return 55.5; > } > > var_dump(blah()); > > Will return 55. It's a little different with properties, but what are > your thoughts on this runtime conversion? > Hey Will, Sure you'll see 55 in weak mode, but in strict mode you'll see 55.5. I don't really want to delve too much into how return types work in this RFC, because it doesn't feel entirely relevant.

« previous php.internals (#91696) next »