Hey Levi,

> On 1 Jan 2015, at 17:19, Levi Morrison <le...@php.net> wrote:
> 
> On Thu, Jan 1, 2015 at 9:44 AM, Thomas Bley <ma...@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.
>> 
> 
> I would rather have it the other way around. `string $str` is strict
> and some other syntax (notably `(string) $str` or `@string $str`) can
> be loose.

Rather than having it on a function-by-function basis, meaning different APIs 
would have different rules, I am warming to the idea of having a per-file 
strict mode. That is, if you used something like “use strict;” at the top of 
your code, functions you called would have strict parameter type checking. But 
if you didn’t, they’d be loose. This way all APIs would be consistent, but 
you’d have the choice of strictness or non-strictness as you see fit.

This would be similar to Hack’s Strict and Decl modes.

I’m not necessarily saying it’s the best idea, but it’s certainly an option. 
The syntax is already reserved! ;)

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





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to