Re: [RFC] Scalar Type Hints v0.2

From: Date: Mon, 02 Feb 2015 16:17:19 +0000
Subject: Re: [RFC] Scalar Type Hints v0.2
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi Markus,

> On 2 Feb 2015, at 14:25, Markus Fischer <[email protected]> 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

Thanks for your contributions.

--
Andrea Faulds
http://ajf.me/






Thread (148 messages)

« previous php.internals (#81595) next »