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

2020-05-06 Thread Dan Ackroyd
Benas IML wrote: > Is there any update on the RFC? Given that there isn't much discussion and 2 > weeks have passed, ... The "two weeks" thing is a minimum. I personally would prefer if most discussions were longer than that whenever possible. It's entirely possible for someone to not have time

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

2020-05-04 Thread Benas IML
Hello, Is there any update on the RFC? Given that there isn't much discussion and 2 weeks have passed, I believe it's safe to move this into a voting phase. Best regards, Benas Seliuginas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

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

2020-04-30 Thread Dan Ackroyd
Bob Weinand wrote: > Mixed is a hack, do not use mixed. > ... > As such the introduction of mixed is pretty much necessary. > I'm actually in favor of introducing it. Matthew Brown wrote: > I'm opposed to the use mixed in codebases ... > A type system without an explicit mixed type feels incomplet

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

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

2020-04-23 Thread Ilija Tovilo
Sorry, I don't know what's wrong with my mail client, it just sent the email with no content. Here's it again. Hi Dan > 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. I don't have a whole

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

2020-04-23 Thread Ilija Tovilo

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

2020-04-23 Thread Gabriel Caruso
On Mon, 20 Apr 2020 at 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 experienc

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

2020-04-23 Thread Guilliam Xavier
rance > wrote ... > > I don't seem to have this message, and can't find it in any archives; was > it sent off-list by mistake? I don't know why Barney's email didn't make it to the list... In my box, it seems to have correct headers, notably: Subject: Re:

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

2020-04-23 Thread Rowan Tommins
> On Wed, Apr 22, 2020 at 11:10 PM Barney Laurance wrote ... I don't seem to have this message, and can't find it in any archives; was it sent off-list by mistake? On Thu, 23 Apr 2020 at 10:26, Guilliam Xavier wrote: > Indeed, < > https://www.php.net/manual/en/language.pseudo-types.php#langua

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

2020-04-23 Thread Christoph M. Becker
On 23.04.2020 at 11:26, Guilliam Xavier wrote: > On Wed, Apr 22, 2020 at 11:10 PM Barney Laurance > wrote: > >> Taking a random example, arguments to str_replace documented as mixed >> accept string|array and not anything else. > > Indeed, >

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

2020-04-23 Thread Guilliam Xavier
On Wed, Apr 22, 2020 at 11:10 PM Barney Laurance wrote: > > The union of all other types is the top type, but I think as used in phpDoc > mixed is often really a dynamic type, rather than a top type. > > The top type (e.g. Typescript's 'unknown') is the supertype of all other > types, > while the

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

2020-04-21 Thread Guilliam Xavier
On Tue, Apr 21, 2020 at 11:10 AM Côme Chilliet wrote: > > Le lundi 20 avril 2020, 09:15:24 CEST Sara Golemon a écrit : > > use mixed = null|bool|int|float|string|array|object|resource; > > use scalar = null|bool|int|float|string; > > I’m wondering if null should maybe be left out of these, since ?

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

2020-04-21 Thread Dan Ackroyd
On Mon, 20 Apr 2020 at 16:17, Larry Garfield wrote: > I... cannot actually envision what code would actually accept that mess. :-) var_dump() would be one example. Also caches that can store any userland value would be another reasonably common use. The general pattern is when you're handling s

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

2020-04-21 Thread Côme Chilliet
Le lundi 20 avril 2020, 09:15:24 CEST Sara Golemon a écrit : > use mixed = null|bool|int|float|string|array|object|resource; > use scalar = null|bool|int|float|string; I’m wondering if null should maybe be left out of these, since ?mixed and ?scalar can be used for this? -- Côme Chilliet Fusion

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

2020-04-20 Thread Larry Garfield
On Mon, Apr 20, 2020, at 10:45 AM, Benjamin Eberlei wrote: > > Sure, but how often is that an actual description of what the code > > accepts? I... cannot actually envision what code would actually accept > > that mess. :-) > > > > I can think of quite a few: > > - var_dump, print_r, more gener

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

2020-04-20 Thread Albert Casademont
As Larry was asking for an example. The ParameterBag::get() function from Symfony (and others) that allows you to fetch request params, for example. That's a mixed type that could return different values, depending on your request body. Yes, I can type for all possible scalar values + null + array

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

2020-04-20 Thread Máté Kocsis
> > But how would this work for serializing resources, which is part of mixed? > https://3v4l.org/n9D2S The point is that many internal functions accept all types (including resources), even though they might not do much useful with some of them. Besides the functions that Benjamin mentioned, I'

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

2020-04-20 Thread Guilliam Xavier
On Mon, Apr 20, 2020 at 5:17 PM Larry Garfield wrote: > > With union types and stringable already on the way, I'm not sure what other > non-hypothetical use cases would still be that fugly that you'd now need to > fall back to `mixed`. For instance: - the parameter of [a wrapper around] getty

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

2020-04-20 Thread Markus Fischer
Hi, just picking on one of the examples: On 20.04.20 17:45, Benjamin Eberlei wrote: - json_encode, serialize, and more generally serialization and encoding functions, as return value as well for the inverse operations But how would this work for serializing resources, which is part of mixed?

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

2020-04-20 Thread Guilliam Xavier
On Mon, Apr 20, 2020 at 4:15 PM Sara Golemon wrote: > > For the long term good of the language I'd prefer type aliases (or typedefs > or usings or whatever you want to call them. > > use mixed = null|bool|int|float|string|array|object|resource; > use scalar = null|bool|int|float|string; > use numb

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

2020-04-20 Thread Máté Kocsis
Hi Larry, > Sure, but how often is that an actual description of what the code > accepts? I... cannot actually envision what code would actually accept > that mess. :-) > For example the recently added get_debug_type() function does, along with dozens of internal functions. Besides messy code,

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

2020-04-20 Thread Benjamin Eberlei
On Mon, Apr 20, 2020 at 5:17 PM Larry Garfield wrote: > On Mon, Apr 20, 2020, at 9:15 AM, Sara Golemon wrote: > > On Mon, Apr 20, 2020 at 8:52 AM Larry Garfield > > wrote: > > > > > On Mon, Apr 20, 2020, at 6:17 AM, Dan Ackroyd wrote: > > > > Here is an RFC for adding a 'mixed' type to the langu

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

2020-04-20 Thread Larry Garfield
On Mon, Apr 20, 2020, at 9:15 AM, Sara Golemon wrote: > On Mon, Apr 20, 2020 at 8:52 AM Larry Garfield > wrote: > > > On Mon, Apr 20, 2020, at 6:17 AM, Dan Ackroyd wrote: > > > Here is an RFC for adding a 'mixed' type to the language: > > > https://wiki.php.net/rfc/mixed_type_v2 > > > > > > > I a

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

2020-04-20 Thread Sara Golemon
On Mon, Apr 20, 2020 at 8:52 AM Larry Garfield wrote: > On Mon, Apr 20, 2020, at 6:17 AM, Dan Ackroyd wrote: > > Here is an RFC for adding a 'mixed' type to the language: > > https://wiki.php.net/rfc/mixed_type_v2 > > > > I am not against this, but now that we have Union types what places are > t

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

2020-04-20 Thread Larry Garfield
On Mon, Apr 20, 2020, at 6:17 AM, 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 exper

[PHP-DEV] [RFC] Mixed type

2020-04-20 Thread Dan Ackroyd
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 experience in upgrading an application to PHP 7.4. Being able to add ty

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

2018-07-01 Thread Levi Morrison
On Sun, Jul 1, 2018 at 11:27 AM Rasmus Schultz wrote: > I think we'll need the mixed type-hint in any case if we're to move > ahead with generics? I think Rasmus is alluding to this: interface Iterator { // rest of impl } So that we can make things generic but backwards compatib

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

2018-07-01 Thread Rasmus Schultz
Nikita, I think we'll need the mixed type-hint in any case if we're to move ahead with generics? On Sat, Jun 30, 2018 at 10:30 PM, Nikita Popov wrote: > On Sat, Jun 30, 2018 at 10:17 PM, Sara Golemon wrote: > >> On Sat, Jun 30, 2018 at 3:08 PM, Stanislav Malyshev >> wrote: >> >> Together wit

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

2018-07-01 Thread Gabriel Caruso
> > >> Together with Michael Moravec, we’d like to announce that we are >> pretending >> >> to open the Mixed Type RFC (https://wiki.php.net/rfc/mixed-typehint) >> next >> >> Monday (02/07) and we’d like to ask you to take a look into the PR on >> >> GitHub (https://github.com/php/php-src/pull/2603

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

2018-06-30 Thread Stanislav Malyshev
Hi! > I would enjoy a 'mixed' typehint for exactly that reason; i.e., that I don't > have to put it in a docblock. I think it is exactly the opposite of what should be happening in the language - putting things in the code which belong in the documentation, so you don't have to write documentati

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

2018-06-30 Thread Nikita Popov
On Sat, Jun 30, 2018 at 10:17 PM, Sara Golemon wrote: > On Sat, Jun 30, 2018 at 3:08 PM, Stanislav Malyshev > wrote: > >> Together with Michael Moravec, we’d like to announce that we are > pretending > >> to open the Mixed Type RFC (https://wiki.php.net/rfc/mixed-typehint) > next > >> Monday (02

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

2018-06-30 Thread Paul Jones
> On Jun 30, 2018, at 15:17, Sara Golemon wrote: > > I'm not super excited about this RFC because, as you say, this information > could be easily encoded into the docblock for the function/method. I would enjoy a 'mixed' typehint for exactly that reason; i.e., that I don't have to put it in

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

2018-06-30 Thread Sara Golemon
On Sat, Jun 30, 2018 at 3:08 PM, Stanislav Malyshev wrote: >> Together with Michael Moravec, we’d like to announce that we are pretending >> to open the Mixed Type RFC (https://wiki.php.net/rfc/mixed-typehint) next >> Monday (02/07) and we’d like to ask you to take a look into the PR on >> GitHub

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

2018-06-30 Thread Stanislav Malyshev
Hi! > Together with Michael Moravec, we’d like to announce that we are pretending > to open the Mixed Type RFC (https://wiki.php.net/rfc/mixed-typehint) next > Monday (02/07) and we’d like to ask you to take a look into the PR on > GitHub (https://github.com/php/php-src/pull/2603) and let us know

[PHP-DEV] [RFC] Mixed type

2018-06-30 Thread Gabriel Caruso
Hello, internals Together with Michael Moravec, we’d like to announce that we are pretending to open the Mixed Type RFC (https://wiki.php.net/rfc/mixed-typehint) next Monday (02/07) and we’d like to ask you to take a look into the PR on GitHub (https://github.com/php/php-src/pull/2603) and let us