Re: [PHP-DEV] Reviving scalar type hints

2015-02-20 Thread Josh Watzman
On Feb 20, 2015, at 10:30 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/20/2015 09:39 AM, Anthony Ferrara wrote: I think if anything, the appearance of Hack (and its adoption) show that people want static typing, at least to some level... To be perfectly transparent here though, you

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-19 Thread Josh Watzman
On Dec 12, 2014, at 11:09 AM, Josh Watzman jwatz...@fb.com wrote: On Dec 10, 2014, at 11:24 PM, Stanislav Malyshev smalys...@gmail.com wrote: the real-world code I've seen, it is the least confusing. (I'll see Which real-world code you are talking about? Examples please. I'm having

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-12 Thread Josh Watzman
On Dec 10, 2014, at 11:24 PM, Stanislav Malyshev smalys...@gmail.com wrote: the real-world code I've seen, it is the least confusing. (I'll see Which real-world code you are talking about? Examples please. I'm having trouble digging any up -- FB's codebase has 10k occurrences of this

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 8:17 AM, Robert Stoll p...@tutteli.ch wrote: First of all, I like the RFC, I think as well that it is a useful feature for PHP and I already have it on my wish list ;) Yet, either I misunderstand the section about short circuiting or I propose to change the behaviour.

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 9:19 AM, Andrea Faulds a...@ajf.me wrote: Hi again, I was in favour of this, but upon further thought, I’m not sure I am. I remember I also initially liked it in Hack and then lost interest. First, how is this substantially different from catching an exception? With

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-10 Thread Josh Watzman
.huh? I'm not talking about exceptions the object itself throws. In PHP 7, if Nikita's RFC passes, trying to call a method on NULL will throw an exception. That largely negates the need for a special operator, since you can just catch the exception. Thanks. -- Andrea Faulds I

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 12:30 PM, Robert Stoll p...@tutteli.ch wrote: I stick with it, evaluating it does not make sense IMO. If I want to execute it in any case then I would do something like this currently $g = g(); $h = h(); if($x !== null){ $x-foo($g, $h)-bar(baz()); } And with the

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 4:12 PM, Christoph Becker cmbecke...@gmx.de wrote: Josh Watzman wrote: However, for a lot of failures, I don't feel that exceptions are appropriate. I tend to only use them for exceptional behavior -- usually, some failure that needs to be propagated up a few levels up

[PHP-DEV] [RFC] Nullsafe calls

2014-12-09 Thread Josh Watzman
one for PHP as well, so I'm submitting this RFC to add it -- you can see the RFC itself for a full discussion of the motivation for the feature, as well as the feature itself: https://wiki.php.net/rfc/nullsafe_calls Josh Watzman -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] [RFC] Nullsafe calls

2014-12-09 Thread Josh Watzman
On Dec 9, 2014, at 3:18 PM, Andrea Faulds a...@ajf.me wrote: On 9 Dec 2014, at 23:07, Josh Watzman jwatz...@fb.com wrote: Hey internals! A useful feature that Hack picked up in the last few months are nullsafe calls, a way of propagating failure forward in a series of chained method calls

Re: [PHP-DEV] [RFC] Abstract final classes

2014-12-02 Thread Josh Watzman
cases for being able to override such a class are questionable at best, as above. This really is just the combination of two existing class modifiers -- no need to introduce a new static modifier. And it leads to lots of interesting issues, as above. Josh Watzman -- PHP Internals - PHP Runtime

Re: [PHP-DEV] [RFC] Safe Casting Functions

2014-10-21 Thread Josh Watzman
On Oct 20, 2014, at 6:17 PM, Andrea Faulds a...@ajf.me wrote: On 21 Oct 2014, at 02:07, Josh Watzman jwatz...@fb.com wrote: Throwing an exception or even returning NULL seems so much better than returning false -- false is a boolean, not an error, and despite some historical cases of PHP

Re: [PHP-DEV] [RFC] Safe Casting Functions

2014-10-20 Thread Josh Watzman
On Oct 20, 2014, at 3:57 PM, Andrea Faulds a...@ajf.me wrote: Good evening, I am presenting a new RFC to add a set of three functions to do validated casts for scalar types: https://wiki.php.net/rfc/safe_cast Please read it. Thanks! I think this is pretty cool, but I'm really

Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures

2014-08-11 Thread Josh Watzman
On Aug 10, 2014, at 11:20 AM, Andrea Faulds a...@ajf.me wrote: Hi! Sorry for the slow response, I’ve been on holiday. No problem! On 8 Aug 2014, at 01:32, Josh Watzman jwatz...@fb.com wrote: The RFC goes a long way to fixing this, but one important place it misses is with function

Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures

2014-08-07 Thread Josh Watzman
sense to be able to do it to the callable reference. (That said, differing here gets into a whole lot of other issues around potentially being confusing when differing from the existing way of representing lambdas via Closure.) Josh Watzman -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-16 Thread Josh Watzman
since there is no such thing as a lossless conversion to any object type, or from any type to an array -- but it's a completely consistent way of extending the way we deal with the existing annotations. (And not inconsistent with casts since it isn't a cast!) Josh Watzman -- PHP Internals