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

2017-12-22 Thread Andreas Hennings
> I think that a "scalar" type that "groups together" bool, float, int, and > string would make more sense. This would allow the expression that something > is not an array, not an object, and not a resource. Why would this be an either/or? I don't mind a "scalar" type hint. But this could be a

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

2017-12-20 Thread Sebastian Bergmann
On 12/20/2017 02:17 PM, li...@rhsoft.net wrote: [...] Off topic: I find it rude that you are posting to this list without providing a real name. what you are talking about are unions statet multiple times in this thread No, I was not talking about union types. What I talked about could

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

2017-12-20 Thread li...@rhsoft.net
Am 20.12.2017 um 13:56 schrieb Sebastian Bergmann: On 12/19/2017 04:34 AM, Michael Moravec wrote: I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: https://wiki.php.net/rfc/mixed-typehint "mixed" is too unspecific. I understand the reasoning behind wanting "mixed": to express

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

2017-12-20 Thread Sebastian Bergmann
On 12/19/2017 04:34 AM, Michael Moravec wrote: I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: https://wiki.php.net/rfc/mixed-typehint "mixed" is too unspecific. I understand the reasoning behind wanting "mixed": to express explicitly that a type declaration was not forgotten.

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

2017-12-19 Thread Fleshgrinder
On 12/19/2017 9:59 PM, li...@rhsoft.net wrote: > yes, it's mostly cosmetic (frankly even the OP statet this in the > initial mail) but if that comes witout a noticebale price to pay why not? > > "It's a simple alias for the current behavior of no type and is fully > interchangeable" sounds like

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

2017-12-19 Thread li...@rhsoft.net
Am 19.12.2017 um 21:53 schrieb Fleshgrinder: On 12/19/2017 8:01 PM, li...@rhsoft.net wrote: but that's a different thing and both don't collide It's not a different thing, that's what I try to tell you. They do not collide, of course not, but having the others is going to make mixed

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

2017-12-19 Thread Fleshgrinder
On 12/19/2017 8:01 PM, li...@rhsoft.net wrote: > but that's a different thing and both don't collide > It's not a different thing, that's what I try to tell you. They do not collide, of course not, but having the others is going to make mixed useless. In other words: if there is no type left to

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

2017-12-19 Thread li...@rhsoft.net
Am 19.12.2017 um 19:19 schrieb Fleshgrinder: On 12/19/2017 6:43 PM, Andreas Hennings wrote: The argument, which I support, is that "mixed" would allow to distinguish against cases of "developer forgot to add a type hint" or "no type hint due to legacy / BC reasons". Also, with a "mixed" type

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

2017-12-19 Thread Fleshgrinder
On 12/19/2017 6:43 PM, Andreas Hennings wrote: > The argument, which I support, is that "mixed" would allow to > distinguish against cases of "developer forgot to add a type hint" or > "no type hint due to legacy / BC reasons". > Also, with a "mixed" type hint, you know it is not "void" (this is >

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

2017-12-19 Thread Andreas Hennings
> For correctness: `callable` is not the union `string | array | object` > because only certain kinds of strings, arrays, and objects are accepted. Correct. > this thread is about `mixed` > which I would vote against. As our type-system stands it provides > almost no value The argument, which

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

2017-12-19 Thread li...@rhsoft.net
Am 19.12.2017 um 18:30 schrieb Levi Morrison: In any case we are straying off-topic: this thread is about `mixed` which I would vote against. As our type-system stands it provides almost no value. If our type system ever changes and it suddenly provides value then it should be proposed at that

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

2017-12-19 Thread Levi Morrison
On Tue, Dec 19, 2017 at 10:05 AM, Andreas Hennings wrote: > We already have other "meta" types. > E.g. "callable" can be a string, an array, an object with __invoke(). > A "numeric" can be float or int. > A "iterable" can be an array or an traversable object. For

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

2017-12-19 Thread Andreas Hennings
We already have other "meta" types. E.g. "callable" can be a string, an array, an object with __invoke(). A "numeric" can be float or int. A "iterable" can be an array or an traversable object. Technically you are right, my "anything that could be an array index" would be equivalent to

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

2017-12-19 Thread Levi Morrison
On Tue, Dec 19, 2017 at 4:47 AM, Andreas Hennings wrote: > On 19 December 2017 at 08:06, Fleshgrinder wrote: >> What is really needed are `scalar`, `number`, union types, intersection >> types, and all that together with generics. > > Do we have

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

2017-12-19 Thread Andreas Hennings
On 19 December 2017 at 08:06, Fleshgrinder wrote: > What is really needed are `scalar`, `number`, union types, intersection > types, and all that together with generics. Do we have ongoing discussions or RFCs for those already? I know we have one for generics, which seems

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

2017-12-19 Thread Andreas Hennings
Perhaps this is the same reason why we add "public" keyword, even though a member is implicitly public by default. On 19 December 2017 at 12:34, Andreas Hennings wrote: > I agree with Michael Kliewe. > When looking at code, I want to distinguish between: > - Developer forgot

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

2017-12-19 Thread Andreas Hennings
I agree with Michael Kliewe. When looking at code, I want to distinguish between: - Developer forgot to add a type hint, or it was left out for legacy / BC reasons. - The function can really return various types, at least too many for any more specific type hint. On 19 December 2017 at 04:57,

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

2017-12-19 Thread Michael Kliewe
Am 19.12.2017 um 07:32 schrieb Stanislav Malyshev: > >> I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: >> https://wiki.php.net/rfc/mixed-typehint >> >> The purpose of this RFC is to introduce "mixed" typehint on language level >> to be used >> as a valid typehint. PHP currently

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

2017-12-19 Thread Christian Schneider
Am 19.12.2017 um 09:49 schrieb Stanislav Malyshev : >> The current one isn't any convention, it's just not possible to do >> something else. There's nothing that explicitly allows saying "I accept >> all types", rather than "The type I accept is unspecifed". > > There could

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

2017-12-19 Thread Stanislav Malyshev
Hi! > Why document code? It contributes nothing to the behavior of the code, > well, unless you parse it as annotations. I am not sure I understand - are you arguing for supporting "mixed" in *documentation*? Then it's already supported and there's no need for any RFC. But if you're arguing for

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

2017-12-19 Thread Niklas Keller
> > > I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: > > https://wiki.php.net/rfc/mixed-typehint > > > > The purpose of this RFC is to introduce "mixed" typehint on language > level > > to be used > > as a valid typehint. PHP currently forces users to not use any type in > case >

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

2017-12-18 Thread Fleshgrinder
On 12/19/2017 7:32 AM, Stanislav Malyshev wrote: > I'm not sure what's the point of it. "mixed" means "any type". Not > writing a type means "any type". So why waste space and add something > that contributes nothing when everybody is already using the current > convention and the new one does not

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

2017-12-18 Thread Stanislav Malyshev
Hi! > I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: > https://wiki.php.net/rfc/mixed-typehint > > The purpose of this RFC is to introduce "mixed" typehint on language level > to be used > as a valid typehint. PHP currently forces users to not use any type in case > the > type

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

2017-12-18 Thread li...@rhsoft.net
Am 19.12.2017 um 04:44 schrieb Michael Morris: On Mon, Dec 18, 2017 at 10:34 PM, Michael Moravec wrote: Hello internals, I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: https://wiki.php.net/rfc/mixed-typehint The purpose of this RFC is to introduce

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

2017-12-18 Thread Michael Morris
On Mon, Dec 18, 2017 at 10:34 PM, Michael Moravec wrote: > Hello internals, > > I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: > https://wiki.php.net/rfc/mixed-typehint > > The purpose of this RFC is to introduce "mixed" typehint on language level > to be

[PHP-DEV] [RFC] Mixed Typehint

2017-12-18 Thread Michael Moravec
Hello internals, I'd like to propose and discuss Mixed Typehint RFC for PHP 7.3: https://wiki.php.net/rfc/mixed-typehint The purpose of this RFC is to introduce "mixed" typehint on language level to be used as a valid typehint. PHP currently forces users to not use any type in case the type is