Re: [PHP-DEV] Reviving scalar type hints

2015-02-20 Thread Josh Watzman
On Feb 20, 2015, at 10:30 AM, Rasmus Lerdorf 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 should mention

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

2014-12-19 Thread Josh Watzman
On Dec 12, 2014, at 11:09 AM, Josh Watzman wrote: > On Dec 10, 2014, at 11:24 PM, Stanislav Malyshev 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. &

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

2014-12-12 Thread Josh Watzman
On Dec 10, 2014, at 11:24 PM, Stanislav Malyshev 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 feature and I have ye

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

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 4:12 PM, Christoph Becker 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 propaga

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

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 12:30 PM, Robert Stoll 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
>> .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 Fau

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

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 9:19 AM, Andrea Faulds 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 > Niki

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

2014-12-10 Thread Josh Watzman
On Dec 10, 2014, at 8:17 AM, Robert Stoll 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. > > "If

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

2014-12-09 Thread Josh Watzman
On Dec 9, 2014, at 3:18 PM, Andrea Faulds wrote: >> On 9 Dec 2014, at 23:07, Josh Watzman 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 >

[PHP-DEV] [RFC] Nullsafe calls

2014-12-09 Thread Josh Watzman
would be a good 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

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

2014-12-02 Thread Josh Watzman
ether means you have a class that has no instances itself, and cannot be subclasses, so you can never have an object of that type. The use 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 ne

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

2014-10-21 Thread Josh Watzman
On Oct 20, 2014, at 6:17 PM, Andrea Faulds wrote: >> On 21 Oct 2014, at 02:07, Josh Watzman wrote: >> >> Throwing an exception or even returning NULL seems so much better than >> returning "false" -- "false" is a boolean, not an error, and despite s

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

2014-10-20 Thread Josh Watzman
On Oct 20, 2014, at 3:57 PM, Andrea Faulds 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 worrie

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 wrote: > Hi! > > Sorry for the slow response, I’ve been on holiday. No problem! > On 8 Aug 2014, at 01:32, Josh Watzman wrote: > >> The RFC goes a long way to fixing this, but one important place it misses is >>

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

2014-08-07 Thread Josh Watzman
[Andrea, please forward this to internals if you don't see my message appear there in a few hours; as you know, FB is working through issues sending email to internals, and though I think I know how to get it through, if it doesn't make it, please help :) Thanks!] On Aug 4, 2014, at 12:49 PM, A

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

2014-07-16 Thread Josh Watzman
detail that "strict enforcement" for scalars is defined in terms of "lossless conversion" as outlined in the RFC, since that's the "PHP way" of loosely dealing with scalar types. The idea of "lossless conversion" has just never been relevant before since