Re: [RFC] Scalar Type Hints v0.2
| From: | Andrey Andreev | Date: | Mon, 02 Feb 2015 16:28:09 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints v0.2 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81596@lists.php.net to get a copy of this message | ||
Hi,
On Mon, Feb 2, 2015 at 6:17 PM, Andrea Faulds <ajf@ajf.me> wrote:
> Hi Markus,
>
>> On 2 Feb 2015, at 14:25, Markus Fischer <markus@fischer.name> wrote:
>>
>> - Since consensus on the strict mode does part the community (or, the
>> greater community also outside @internals) my impression is that the
>> current best way to move forward would be
>>
>> - get the rfc to only go for weak types for now
>> - using the "cast-like syntax": function foo( (int) $bar );
>>
>> and ultimately keep the strict type out for /now/ and try it at a later
>> time, the "function foo( int $bar )"-syntax.
>
> I’m not sure that really works that well. It’s not a terribly good compromise: If you want
> strict typing, you not only haven’t got it, but even worse, you’ll be forced to deal with weak
> typing if you use the wrong library, because the (int) syntax would be specifically for weak types.
> It’s not really a compromise at all, actually..
>
>> I'm actually not really in favor of just weak types, I would consider
>> myself a "strict type" voter, but through the community communication
>> here I saw a) the benefits of weak types hinting/casting b) without
>> getting in the way of a possible future strict type (e.g. with the
>> "non-cast-like syntax”).
>
> Well this RFC tries to strike a different balance: rather than having the chaos of some
> functions using weak types, others strict types, others both, it just adds scalar types and lets you
> choose the behaviour that suits you. It means weak typing fans can live in their weakly-typed world,
> and strict typing fans can live in their strictly-typed world. That’s the idea, anyway.
>
> But I’m just going in circles at this point. :P
>
If chaos is what you call it - we want chaos. :P
Cheers,
Andrey.