Re: [RFC] Scalar Type Hints
| From: | Thomas Bley | Date: | Thu, 01 Jan 2015 17:09:22 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80063@lists.php.net to get a copy of this message | ||
> The problem is that the current proposed hints/casts are deviating from the
> type-hints that we are used to
I don't think type hints we currently have are different. The only difference we have is that
there is no automatic casting for objects/arrays to scalars and scalars to objects/arrays (I exclude
__toString() and $a=[]; echo $a;).
Regards
Thomas
Marco Pivetta wrote on 01.01.2015 17:56:
> On 1 January 2015 at 17:44, Thomas Bley <mails@thomasbley.de> wrote:
>
>> I think it is no problem to add strict parameter type hints with another
>> rfc (if this rfc gets accepted), e.g. function foobar(string! $str, int!
>> $str){} or any other syntax.
>>
>
> The problem is that the current proposed hints/casts are deviating from the
> type-hints that we are used to, therefore this particular feature should
> (eventually) have an alternate syntax, whereas the strict hints would just
> use
int, integer,
> string, float,
> bool, boolan without
> additional chars (assuming that we will get strict hints somewhen).
>
> This will also reduce clashes with the current HHVM implementation.
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>