Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast

[email protected] (Rowan Collins)
Newsgroups php.internals
Message-ID <[email protected]>
On 14/09/2014 20:01, Pierre Joye wrote:
> One side wants to be consistent with inconsistencies (and tbh quite 
> confusing) while the other side wants to allow userland implemented 
> APIs to actually be consistent.

I'm not sure that's quite fair. The only thing that would be consistent 
with existing userland functionality is strict typing, fatal error on 
incorrect type (since that's what class "hints" do; they're more like 
assertions than anything else); I'm pretty sure nobody is arguing for that.

There's also definitely more than two "sides" here - there are lots of 
people, with lots of different opinions. I'm guessing what *you* want is 
for it to be consistent with existing userland casts? i.e. function 
foo(int $bar) { /* ... */ } is just syntactic sugar for function 
foo($bar) { $bar = (int)$bar; /* ... */ }

Perhaps it would be better to discuss how *useful* that would be as a 
feature, rather than just how consistent it is or isn't with other parts 
of the language.

-- 
Rowan Collins
[IMSoP]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.