Re: [PHP-DEV] Re: [RFC] PHP Namespace Policy

2020-04-24 Thread Michael Morris
On Fri, Apr 24, 2020 at 6:09 PM Mark Randall wrote: > On 25/04/2020 00:00, Michael Morris wrote: > > So, in steps: > > > > 1. Take the current function roster - all of it - and put it in > > \PHP\Legacy\. So the formal name of strpos would become > > \PHP\Legacy\strpos. > > 2. The root namespace

Re: [PHP-DEV] Re: [RFC] PHP Namespace Policy

2020-04-24 Thread Mark Randall
On 25/04/2020 00:00, Michael Morris wrote: So, in steps: 1. Take the current function roster - all of it - and put it in \PHP\Legacy\. So the formal name of strpos would become \PHP\Legacy\strpos. 2. The root namespace would be empty BUT... 3. An INI directive set globally or per directory can

Re: [PHP-DEV] Re: [RFC] PHP Namespace Policy

2020-04-24 Thread Michael Morris
On Thu, Apr 23, 2020 at 9:48 AM Mark Randall wrote: > On 15/04/2020 12:21, Mark Randall wrote: > > https://wiki.php.net/rfc/php_namespace_policy > > Just an update in light of the two different RFCs. > > Having chatted with the other RFC authors in R11, rather than racing to > see who can get the

Re: [PHP-DEV] Typed callable properties

2020-04-24 Thread moliata
Hello, I would like to correct myself (credits to Marco Pivetta for informing me) regarding union types. While we still wouldn't be able to declare a type alias as `callable` and then use it in properties, technically speaking `string|array|object` would allow to pass callables. As such, my point

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread moliata
Hello, I did some tests and in fact it seems you're right. Thank you for letting me know, didn't know! Best regards, Benas Seliuginas ‐‐‐ Original Message ‐‐‐ On Friday, April 24, 2020 6:44 PM, Marco Pivetta wrote: > Hey moliata, > > On Fri, Apr 24, 2020 at 5:27 PM moliata moli...@pr

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Marco Pivetta
Hey moliata, On Fri, Apr 24, 2020 at 5:27 PM moliata wrote: > Actually, it's not quite possible to declare a `mixed` type using union > types given that it's not possible to make properties as callable (please > take a look at my "Typed callable properties" post in the mailing list). As > such,

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread moliata
Actually, it's not quite possible to declare a `mixed` type using union types given that it's not possible to make properties as callable (please take a look at my "Typed callable properties" post in the mailing list). As such, if we wanted to make a property hold a callable, we would have to fa

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread moliata
I personally would stick to `mixed`. It's used extensively in the official PHP documentation and has grown with the language. Heck, even static analysis tools and billions of PHPDoc comments (e. g. Laravel, CakePHP, Yii) use `mixed` type. Switching to `any` just doesn't feel right. Oh and well, I

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Matthew Brown
> > How much would you like/be adverse to a rector rule that changes `mixed` > into a long union type (without `resource` in it)? > Considering above posts, `mixed` is effectively > `null|bool|string|int|float|array|object|resource`, > At runtime those things are effectively the same, but in th

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Markus Fischer
On 24.04.20 16:33, Bob Weinand wrote: Actually, Really had to laugh, reading your previous and then this mail :-) I forgot that for proper generics implementations, collections etc. will obviously need to specify "allowing any type". As such the introduction of mixed is pretty much necess

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Bob Weinand
Actually, I forgot that for proper generics implementations, collections etc. will obviously need to specify "allowing any type". As such the introduction of mixed is pretty much necessary. As in class Foo { … } $foo = new Foo; As such, I'm actually in favor of introducing it. Bob > Am 24.04

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Marco Pivetta
Hey Dan, On Mon, Apr 20, 2020, 13:18 Dan Ackroyd wrote: > Hi Internals, > > Here is an RFC for adding a 'mixed' type to the language: > https://wiki.php.net/rfc/mixed_type_v2 > The RFC builds on an earlier draft by Michael Moravec. > > Part of the motivation for pursuing this RFC was my recent

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Matthew Brown
> > I'm not as strongly against adding "mixed" to the language as Bob, but I'm > not convinced I'd ever bother using it. > I'm opposed to the use mixed in codebases – I try as best I can to remove it from any code I come across, and a static analysis tool I've built flags the use of mixed types wh

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Rowan Tommins
On Fri, 24 Apr 2020 at 13:18, Lynn wrote: > I would love to see mixed being added as it lets me remove a lot of > docblocks that are only added so I can indicate mixed. I disagree that it's > patching holes, it's filling a gap that's currently missing something. > I realise it's partly a matter

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Lynn
On Fri, Apr 24, 2020 at 2:12 PM Bob Weinand wrote: > Mixed is in almost every case just patching the holes in PHPs type system. > And as such, I'd rather promote RFCs trying to properly fix the gaps in the > type system than supporting mixed. > > Mixed is a hack, do not use mixed. > Heya Bob, I

Re: [PHP-DEV] [RFC] Mixed type

2020-04-24 Thread Bob Weinand
Hey Dan, this, I consider one of the few concepts which should never make it into PHP. In particular, the main problem with mixed is that it is a very easy "I have no idea how to type that properly, so just let's use mixed". And really, in general, except for some debug functions, mixed is just