Re: [PHP-DEV] Object Type Casting Reloaded

2019-04-22 Thread Marcos Passos
Such a feature would be very helpful to ensure type safety! A big +1! On Mon, Apr 22, 2019 at 19:51 Benjamin Morel wrote: > Hi Azjezz, thanks for jumping in! > > > I have been using HackLang for quite a while now and i believe they have > a better solution for this, and it would awesome to see i

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Marcos Passos
ame as no type-hint at all. > > Regards, > Robert Korulczyk > > W dniu 08.02.2019 o 15:54, Marcos Passos pisze: > > Those cases should be handled with runtime validation, there is no > reason for changing the concept of mixed. > > > > On Fri, Feb 8, 2

Re: [PHP-DEV] Re: PHP 8: Method Overloading, The Ressurection

2019-02-03 Thread Marcos Passos
I believe we can adopt the behaviour of mature languages that supports this feature. Java, for instance, throw a compile-time error saying that the method signature is ambiguous. On Sun, Feb 3, 2019 at 17:51 David Rodrigues wrote: > Em dom, 3 de fev de 2019 às 17:19, Rowan Collins > escreveu: >

Re: [PHP-DEV] [RFC] JIT

2019-01-31 Thread Marcos Passos
JIT, FFI, covariant return types and typed properties: what a year for PHP. Thank you all for working on making PHP better and better. - Marcos Em qui, 31 de jan de 2019 às 08:54, Dmitry Stogov escreveu: > > > On 1/31/19 1:15 PM, Albert Casademont wrote: > > Hi all, > > > > This is fantastic n

Re: [PHP-DEV] Unserializes, inheritance and allows_classes

2019-01-17 Thread Marcos Passos
e 2019 às 23:03, Marco Pivetta escreveu: > > > On Fri, Jan 18, 2019 at 2:00 AM Marcos Passos > wrote: > >> How would you fix this example, then? Perhaps we should add more examples >> in the docs. >> > > You'd include all expected child classes in the li

Re: [PHP-DEV] Unserializes, inheritance and allows_classes

2019-01-17 Thread Marcos Passos
How would you fix this example, then? Perhaps we should add more examples in the docs. Em qui, 17 de jan de 2019 às 22:53, Marco Pivetta escreveu: > On Fri, Jan 18, 2019 at 1:50 AM Marcos Passos > wrote: > >> Hi Marco, >> >> Also: nothing denies an attacker from

Re: [PHP-DEV] Unserializes, inheritance and allows_classes

2019-01-17 Thread Marcos Passos
22:24, Marco Pivetta escreveu: > > On Fri, Jan 18, 2019 at 12:49 AM Marcos Passos > wrote: > >> Hi internals, >> >> Today I stumbled upon a limitation when implementing the unserialize >> method >> of a serializable class which depends on an abstraction

[PHP-DEV] Unserializes, inheritance and allows_classes

2019-01-17 Thread Marcos Passos
Hi internals, Today I stumbled upon a limitation when implementing the unserialize method of a serializable class which depends on an abstraction also serializable. Currently, there is no way to unserialize an object specifying a parent class in the allowed_classes option: class SerializableBase

Re: [PHP-DEV] [RFC][Discuss] Covariant return- and contravariant parameter- types

2018-11-27 Thread Marcos Passos
Supporting `static` return would come in handy to define interfaces for immutable objects. Em ter, 27 de nov de 2018 às 19:01, Levi Morrison escreveu: > On Tue, Nov 27, 2018 at 11:36 AM Larry Garfield > wrote: > > > > On Monday, November 26, 2018 3:25:52 PM CST Levi Morrison wrote: > > > I am h

Re: [PHP-DEV] [RFC][Discuss] Covariant return- and contravariant parameter- types

2018-11-26 Thread Marcos Passos
I'm waiting for it for a long time! Thank you for putting effort on this! Em seg, 26 de nov de 2018 às 19:26, Levi Morrison escreveu: > I am happy to announce my latest RFC, [Covariant Returns and > Contravariant Parameters][1], is open for discussion. If you do not > recognize those terms then

[PHP-DEV] Proposal - Introduce NumberFormat::TYPE_DECIMAL

2018-10-14 Thread Marcos Passos
8f1> /formatDecimal <http://icu-project.org/apiref/icu4c/unum_8h.html#af80334a90b37b2d5c41bd9db00c98687> from the ICU library. It would bring many possibilities for libraries that work with precise numbers, such as arbitrary precision math (even BC-math) and monetary values. What do you think? - Marcos Passos

Re: [PHP-DEV] Class name resolution for \array::class

2018-10-01 Thread Marcos Passos
le, indeed. The whole point was about making it consistent before you stated that this use case become valid by mistake. Em seg, 1 de out de 2018 às 10:52, Rowan Collins escreveu: > On Mon, 1 Oct 2018 at 14:30, Marcos Passos > wrote: > >> Sorry, it looks like I've replied to Mar

Re: [PHP-DEV] Class name resolution for \array::class

2018-10-01 Thread Marcos Passos
? Em seg, 1 de out de 2018 às 10:15, Rowan Collins escreveu: > On Mon, 1 Oct 2018 at 13:24, Marcos Passos > wrote: > >> >> You can also see it as a language construct that expects a type at the >> left-hand side of the name resolution operator. In that sense, primiti

Re: [PHP-DEV] Class name resolution for \array::class

2018-10-01 Thread Marcos Passos
: > On Mon, 1 Oct 2018 at 00:30, Marcos Passos > wrote: > >> Currently, class name resolution supports all types except an array. >> https://3v4l.org/OXFMW >> > > It seems to me that the bug is allowing an expression like "int::class" to > resolve, whe

[PHP-DEV] Class name resolution for \array::class

2018-09-30 Thread Marcos Passos
Currently, class name resolution supports all types except an array. https://3v4l.org/OXFMW In fact, it is syntactically invalid since the parser fails to recognize `array::class` as an array expression: Parse error: syntax error, unexpected 'array' (T_ARRAY), expecting > identifier (T_STRING) >

Re: [PHP-DEV] Interruptions

2018-09-26 Thread Marcos Passos
Have you tried generators? It looks like you are trying to implement coroutines. You can learn more about cooperative multitasking in PHP on this awesome post written by Nikic: https://nikic.github.io/2012/12/22/Cooperative-multitasking-using-coroutines-in-PHP.html - Marcos On Wed, Sep 26, 2018

Re: [PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
one cannot document what has never been defined. > > What you're describing is UNdefined. Undefined things cannot be documented. > > > On Wed, Aug 1, 2018, 3:46 PM Marcos Passos > wrote: > >> *The point is not about the possibility of crossing the limit of the >

Re: [PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
iterable pseudo-type. 2018-08-01 16:44 GMT-03:00 Marcos Passos : > It looks like the limit I mentioned, used by some functions, is > architecture-dependent: > https://github.com/php/php-src/blob/master/Zend/zend_types.h#L288 > > Also, that's such a ridiculously large number f

Re: [PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
said "this is what will happen if a PHP array exceeds size". Until > someone does that, I cannot document it. Also, that's such a ridiculously > large number for the vast majority of people using PHP that hardly anyone > ever runs into this limit. > > > > > O

[PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
Whenever you look for more information about the maximum size of an array, you find someone saying that "PHP arrays do not have a maximum size, but the amount of memory available". However, I could not find any excerpt in PHP documentation that supports that. Even if the engine imposes no hard lim

Re: [PHP-DEV] Nullable cast (?int)

2018-07-31 Thread Marcos Passos
Pretty nice idea! On Tue, Jul 31, 2018 at 22:06 Gabriel Caruso wrote: > > > > Thanks a lot! > > > > 1. I never did a RFC and have no karma to do, so if someone wants to help > > me with that, I appreciate (contact me directly, then we could publish > RPC > > link as reply here). > > > > > Someon

Re: [PHP-DEV] [VOTE] array_key_first(), array_key_last(), array_value_first(), array_value_last()

2018-07-14 Thread Marcos Passos
A function like array_offset would be convenient as there is no way to access the value of an array entry by its index currently. The workaround is using array_slice, with all the downsides already pointed out. 2018-07-13 20:04 GMT-03:00 Levi Morrison : > On Fri, Jul 13, 2018 at 4:50 PM Levi Morr