# Reviving scalar type hints

- Thread: https://externals.io/message/82863
- Original archive: https://news-web.php.net/php.internals/82863
- Started by francois@php.net on 2015-02-16T16:42:12+00:00
- Messages: 111
- Page 1 of 5: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/82863.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #82863 — francois@php.net — 2015-02-16T16:42:12+00:00

URL: https://externals.io/message/82863#82863

Hi,
>
> De : Arvids Godjuks [mailto:arvids.godjuks@gmail.com]
> 
> The 0.1 RFC version was mentioned a lot as a good compromise by many
> people
> and had major support.
> Maybe someone competent could pick it up, make necessary adjustments
> that
> where required and let people vote on it? Start with small steps - get the
> weak type hints into the language first, see how it gets used and then we
> can always add strict type hints if there is a need/desire to do that.
> 
> That way we finally get type hints into the language, and those wanting the
> strict variety have all the opportunities in the world to add them at a
> later release with proper discussion and development time.

That's what I am planning. If I write an RFC, it will be based on Andrea's 0.1/0.2 version, and won't propose different modes.

The problem is that the previous controversial RFC focused people on weak vs strict typing, while we should have explored other technical concerns. Here are the main ones I see :

- the fact that the RFC supports single types only, like the previous 'return type' RFC. While it is easier to implement, it opens several issues as multiply-typed arguments are an integral part of the PHP language (mostly completeness and compatibility with internal function hinting). If we want to support multiple types the same way for internal and userspace functions, we must extend the ZPP layer to support it.

- the mechanism to check for type hints on internal functions, while easy to implement, is not sufficient, as a lot of internal functions get a bare zval from the parsing system and then convert it by themselves. With the proposed mechanism, there's no possible hinting on such argument, which will make the implementation different from the documentation. Even if the check is done by the function body, it won't be done in a consistent way with type hinting checks and won't raise a similar error. As most cases are related to multiply-typed args, the solution is in adding multiply-typed support to ZPP. Multiply-typed support needs to redefine scalar conversion rules, to take care of the target type being a combination of single types.

- We need to define the appropriate extension to Reflection parameters/return type. That's not complex, but it takes time.

- Other changes I'd like to propose are exposed in Bob Weinand's article, at https://gist.github.com/bwoebi/b4c5564388ecd004ba96. The article explains how restricting weak conversion possibilities would make strict typing almost useless. Changes include forbidding bool to int/float or '7years' to int. This cannot be left for future additions as BC breaks will make it impossible. To remain consistent between userspace/internal functions, this must also be done at the ZPP level.

- Using bare class names as type hints is a potential issue too, as it makes reserved keywords and class names share the same naming space. I think we should deprecate the use of class names as type hints in favor of 'object(class-name)'. If we don't do that, every future addition of a type hint keyword will cause a BC break (and will be practically impossible).

- Additional 'hybrid' types like 'numeric' and 'mixed' should be also provided.

So, most features I have in mind are really 'now or never'.

My main concern, anyway, is with March 15 announced feature freeze. If we need a vote by this date, it's impossible. And planning such BC for 7.1 is probably unrealistic because of the huge syntax additions and BC breaks it brings. So, if it's too late for an inclusion in 7.0, I think I'll give up.

So, could someone confirm what 'feature freeze' exactly means ?

Regards

François








 The main issues are completeness (we can give hints for some cases, but not for others) and, more important, the compatibility with internal functions. As Andrea herself agreed, her mechanism for type hinting on internal functions is not sufficient. Just using the ZPP macros, as they exist today, won't work as a lot of internal functions get a bare zval and then convert it by themselves. So, in this case, we would check nothing. So, an argument described as 'string|array' in the documentation, wouldn't produce the same sort of error when sent an object, than its friend, described as 'string'. This is not consistent and will open a lot of side effects if it is left out of the type hint layer.

---

## #82864 — Peter Cowburn — 2015-02-16T16:57:11+00:00

URL: https://externals.io/message/82863#82864 · In reply to: #82863

> Hi,
> > […]
> the
> > […]
> the
> > […]
>
> That's what I am planning. If I write an RFC, it will be based on Andrea's
> 0.1/0.2 version, and won't propose different modes.
>
> The problem is that the previous controversial RFC focused people on weak
> vs strict typing, while we should have explored other technical concerns.
> Here are the main ones I see :
>
> - the fact that the RFC supports single types only, like the previous
> 'return type' RFC. While it is easier to implement, it opens several issues
> as multiply-typed arguments are an integral part of the PHP language
> (mostly completeness and compatibility with internal function hinting). If
> we want to support multiple types the same way for internal and userspace
> functions, we must extend the ZPP layer to support it.
>
> - the mechanism to check for type hints on internal functions, while easy
> to implement, is not sufficient, as a lot of internal functions get a bare
> zval from the parsing system and then convert it by themselves. With the
> proposed mechanism, there's no possible hinting on such argument, which
> will make the implementation different from the documentation. Even if the
> check is done by the function body, it won't be done in a consistent way
> with type hinting checks and won't raise a similar error. As most cases are
> related to multiply-typed args, the solution is in adding multiply-typed
> support to ZPP. Multiply-typed support needs to redefine scalar conversion
> rules, to take care of the target type being a combination of single types.
>
> - We need to define the appropriate extension to Reflection
> parameters/return type. That's not complex, but it takes time.
>
> - Other changes I'd like to propose are exposed in Bob Weinand's article,
> at https://gist.github.com/bwoebi/b4c5564388ecd004ba96. The article
> explains how restricting weak conversion possibilities would make strict
> typing almost useless. Changes include forbidding bool to int/float or
> '7years' to int. This cannot be left for future additions as BC breaks will
> make it impossible. To remain consistent between userspace/internal
> functions, this must also be done at the ZPP level.
>
> - Using bare class names as type hints is a potential issue too, as it
> makes reserved keywords and class names share the same naming space. I
> think we should deprecate the use of class names as type hints in favor of
> 'object(class-name)'. If we don't do that, every future addition of a type
> hint keyword will cause a BC break (and will be practically impossible).
>
> - Additional 'hybrid' types like 'numeric' and 'mixed' should be also
> provided.
>
> So, most features I have in mind are really 'now or never'.
>
> My main concern, anyway, is with March 15 announced feature freeze. If we
> need a vote by this date, it's impossible. And planning such BC for 7.1 is
> probably unrealistic because of the huge syntax additions and BC breaks it
> brings. So, if it's too late for an inclusion in 7.0, I think I'll give up.
>
> So, could someone confirm what 'feature freeze' exactly means ?
>

Note that the accepted timeline for PHP 7 [1] states that we will have
three months to "Finalize implementation & testing of new features", after
the March deadline.  That should give us some time to tie down the actual
implementation side of things. Apart from that, it's more a matter of
getting an RFC drafted, discussed, voted on, before the March deadline.

I, for one, wouldn't mind the vote taking a wee while longer (say, a week
or two) if it means we can get this feature added.


>
> Regards
>
> François
>
>
>
>
>
>
>
>
>  The main issues are completeness (we can give hints for some cases, but
> not for others) and, more important, the compatibility with internal
> functions. As Andrea herself agreed, her mechanism for type hinting on
> internal functions is not sufficient. Just using the ZPP macros, as they
> exist today, won't work as a lot of internal functions get a bare zval and
> then convert it by themselves. So, in this case, we would check nothing.
> So, an argument described as 'string|array' in the documentation, wouldn't
> produce the same sort of error when sent an object, than its friend,
> described as 'string'. This is not consistent and will open a lot of side
> effects if it is left out of the type hint layer.

---

## #82865 — Arvids Godjuks — 2015-02-16T17:06:01+00:00

URL: https://externals.io/message/82863#82865 · In reply to: #82863

2015-02-16 18:42 GMT+02:00 François Laupretre <francois@php.net>:

> Hi,
> > […]
> the
> > […]
> the
> > […]
>
> That's what I am planning. If I write an RFC, it will be based on Andrea's
> 0.1/0.2 version, and won't propose different modes.
>
> The problem is that the previous controversial RFC focused people on weak
> vs strict typing, while we should have explored other technical concerns.
> Here are the main ones I see :
>
> - the fact that the RFC supports single types only, like the previous
> 'return type' RFC. While it is easier to implement, it opens several issues
> as multiply-typed arguments are an integral part of the PHP language
> (mostly completeness and compatibility with internal function hinting). If
> we want to support multiple types the same way for internal and userspace
> functions, we must extend the ZPP layer to support it.
>
> - the mechanism to check for type hints on internal functions, while easy
> to implement, is not sufficient, as a lot of internal functions get a bare
> zval from the parsing system and then convert it by themselves. With the
> proposed mechanism, there's no possible hinting on such argument, which
> will make the implementation different from the documentation. Even if the
> check is done by the function body, it won't be done in a consistent way
> with type hinting checks and won't raise a similar error. As most cases are
> related to multiply-typed args, the solution is in adding multiply-typed
> support to ZPP. Multiply-typed support needs to redefine scalar conversion
> rules, to take care of the target type being a combination of single types.
>
> - We need to define the appropriate extension to Reflection
> parameters/return type. That's not complex, but it takes time.
>
> - Other changes I'd like to propose are exposed in Bob Weinand's article,
> at https://gist.github.com/bwoebi/b4c5564388ecd004ba96. The article
> explains how restricting weak conversion possibilities would make strict
> typing almost useless. Changes include forbidding bool to int/float or
> '7years' to int. This cannot be left for future additions as BC breaks will
> make it impossible. To remain consistent between userspace/internal
> functions, this must also be done at the ZPP level.
>
> - Using bare class names as type hints is a potential issue too, as it
> makes reserved keywords and class names share the same naming space. I
> think we should deprecate the use of class names as type hints in favor of
> 'object(class-name)'. If we don't do that, every future addition of a type
> hint keyword will cause a BC break (and will be practically impossible).
>
> - Additional 'hybrid' types like 'numeric' and 'mixed' should be also
> provided.
>
> So, most features I have in mind are really 'now or never'.
>
> My main concern, anyway, is with March 15 announced feature freeze. If we
> need a vote by this date, it's impossible. And planning such BC for 7.1 is
> probably unrealistic because of the huge syntax additions and BC breaks it
> brings. So, if it's too late for an inclusion in 7.0, I think I'll give up.
>
> So, could someone confirm what 'feature freeze' exactly means ?
>
> Regards
>
> François
>
>
>
>
>
>
>
>
>  The main issues are completeness (we can give hints for some cases, but
> not for others) and, more important, the compatibility with internal
> functions. As Andrea herself agreed, her mechanism for type hinting on
> internal functions is not sufficient. Just using the ZPP macros, as they
> exist today, won't work as a lot of internal functions get a bare zval and
> then convert it by themselves. So, in this case, we would check nothing.
> So, an argument described as 'string|array' in the documentation, wouldn't
> produce the same sort of error when sent an object, than its friend,
> described as 'string'. This is not consistent and will open a lot of side
> effects if it is left out of the type hint layer.
>
>
Sounds quite reasonable and level headed. I'm gonna contact you off-list to
assist in any way I can, i'll be damned if RFC fails 4th time...

---

## #82875 — Dmitry Stogov — 2015-02-16T18:56:15+00:00

URL: https://externals.io/message/82863#82875 · In reply to: #82863

On Mon, Feb 16, 2015 at 7:42 PM, François Laupretre <francois@php.net>
wrote:

> Hi,
> > […]
> the
> > […]
> the
> > […]
>
> That's what I am planning. If I write an RFC, it will be based on Andrea's
> 0.1/0.2 version, and won't propose different modes.
>

I would propose exactly Andrea's 0.1.
Most people were agree to support weak type hints by default.
This proposal won't prevent feature addition of optional strict type hints.
All are tired from endless arguing.


> The problem is that the previous controversial RFC focused people on weak
> vs strict typing, while we should have explored other technical concerns.
> Here are the main ones I see :
>
> - the fact that the RFC supports single types only, like the previous
> 'return type' RFC. While it is easier to implement, it opens several issues
> as multiply-typed arguments are an integral part of the PHP language
> (mostly completeness and compatibility with internal function hinting). If
> we want to support multiple types the same way for internal and userspace
> functions, we must extend the ZPP layer to support it.
>

this is not a big technical problem.

- the mechanism to check for type hints on internal functions, while easy
> to implement, is not sufficient, as a lot of internal functions get a bare
> zval from the parsing system and then convert it by themselves. With the
> proposed mechanism, there's no possible hinting on such argument, which
> will make the implementation different from the documentation. Even if the
> check is done by the function body, it won't be done in a consistent way
> with type hinting checks and won't raise a similar error. As most cases are
> related to multiply-typed args, the solution is in adding multiply-typed
> support to ZPP. Multiply-typed support needs to redefine scalar conversion
> rules, to take care of the target type being a combination of single types.
>

I wouldn't rise this question. Lets it work as is for now.


> - We need to define the appropriate extension to Reflection
> parameters/return type. That's not complex, but it takes time.
>

It's a subject for separate more or less obvious RFC.


> - Other changes I'd like to propose are exposed in Bob Weinand's article,
> at https://gist.github.com/bwoebi/b4c5564388ecd004ba96. The article
> explains how restricting weak conversion possibilities would make strict
> typing almost useless. Changes include forbidding bool to int/float or
> '7years' to int. This cannot be left for future additions as BC breaks will
> make it impossible. To remain consistent between userspace/internal
> functions, this must also be done at the ZPP level.
>

Lets go forward by small steps.
If we would do it before we would already got all the features.
We may restrict ZPP rules by next RFC. I'll most probably support it.
The same for the rest.

Thanks. Dmitry.


> - Using bare class names as type hints is a potential issue too, as it
> makes reserved keywords and class names share the same naming space. I
> think we should deprecate the use of class names as type hints in favor of
> 'object(class-name)'. If we don't do that, every future addition of a type
> hint keyword will cause a BC break (and will be practically impossible).
>

> - Additional 'hybrid' types like 'numeric' and 'mixed' should be also
> provided.
>
> So, most features I have in mind are really 'now or never'.
>
> My main concern, anyway, is with March 15 announced feature freeze. If we
> need a vote by this date, it's impossible. And planning such BC for 7.1 is
> probably unrealistic because of the huge syntax additions and BC breaks it
> brings. So, if it's too late for an inclusion in 7.0, I think I'll give up.
>
> So, could someone confirm what 'feature freeze' exactly means ?
>
> Regards
>
> François
>
>
>
>
>
>
>
>
>  The main issues are completeness (we can give hints for some cases, but
> not for others) and, more important, the compatibility with internal
> functions. As Andrea herself agreed, her mechanism for type hinting on
> internal functions is not sufficient. Just using the ZPP macros, as they
> exist today, won't work as a lot of internal functions get a bare zval and
> then convert it by themselves. So, in this case, we would check nothing.
> So, an argument described as 'string|array' in the documentation, wouldn't
> produce the same sort of error when sent an object, than its friend,
> described as 'string'. This is not consistent and will open a lot of side
> effects if it is left out of the type hint layer.

---

## #82878 — pajousek@gmail.com — 2015-02-16T19:11:39+00:00

URL: https://externals.io/message/82863#82878 · In reply to: #82863

> Hi,
>
> - the fact that the RFC supports single types only, like the previous 'return type' RFC. While it is easier to implement, it opens several issues as multiply-typed arguments are an integral part of the PHP language (mostly completeness and compatibility with internal function hinting). If we want to support multiple types the same way for internal and userspace functions, we must extend the ZPP layer to support it.
>
> - the mechanism to check for type hints on internal functions, while easy to implement, is not sufficient, as a lot of internal functions get a bare zval from the parsing system and then convert it by themselves. With the proposed mechanism, there's no possible hinting on such argument, which will make the implementation different from the documentation. Even if the check is done by the function body, it won't be done in a consistent way with type hinting checks and won't raise a similar error. As most cases are related to multiply-typed args, the solution is in adding multiply-typed support to ZPP. Multiply-typed support needs to redefine scalar conversion rules, to take care of the target type being a combination of single types.
>

Hello,

I know this is probably a pretty unpopular opinion in PHP (based on
the replies I got in the other thread), but different values for
parameters should be IMHO solved by method overloading and such.

Regards
Pavel Kouril

---

## #82880 — Levi Morrison — 2015-02-16T19:57:12+00:00

URL: https://externals.io/message/82863#82880 · In reply to: #82863

> Hi,
> > […]
>
> That's what I am planning. If I write an RFC, it will be based on Andrea's 0.1/0.2 version, and won't propose different modes.
>
> The problem is that the previous controversial RFC focused people on weak vs strict typing, while we should have explored other technical concerns. Here are the main ones I see :
>
> - the fact that the RFC supports single types only, like the previous 'return type' RFC. While it is easier to implement, it opens several issues as multiply-typed arguments are an integral part of the PHP language (mostly completeness and compatibility with internal function hinting). If we want to support multiple types the same way for internal and userspace functions, we must extend the ZPP layer to support it.
>
> - the mechanism to check for type hints on internal functions, while easy to implement, is not sufficient, as a lot of internal functions get a bare zval from the parsing system and then convert it by themselves. With the proposed mechanism, there's no possible hinting on such argument, which will make the implementation different from the documentation. Even if the check is done by the function body, it won't be done in a consistent way with type hinting checks and won't raise a similar error. As most cases are related to multiply-typed args, the solution is in adding multiply-typed support to ZPP. Multiply-typed support needs to redefine scalar conversion rules, to take care of the target type being a combination of single types.
>
> - We need to define the appropriate extension to Reflection parameters/return type. That's not complex, but it takes time.
>
> - Other changes I'd like to propose are exposed in Bob Weinand's article, at https://gist.github.com/bwoebi/b4c5564388ecd004ba96. The article explains how restricting weak conversion possibilities would make strict typing almost useless. Changes include forbidding bool to int/float or '7years' to int. This cannot be left for future additions as BC breaks will make it impossible. To remain consistent between userspace/internal functions, this must also be done at the ZPP level.
>
> - Using bare class names as type hints is a potential issue too, as it makes reserved keywords and class names share the same naming space. I think we should deprecate the use of class names as type hints in favor of 'object(class-name)'. If we don't do that, every future addition of a type hint keyword will cause a BC break (and will be practically impossible).
>
> - Additional 'hybrid' types like 'numeric' and 'mixed' should be also provided.
>
> So, most features I have in mind are really 'now or never'.
>
> My main concern, anyway, is with March 15 announced feature freeze. If we need a vote by this date, it's impossible. And planning such BC for 7.1 is probably unrealistic because of the huge syntax additions and BC breaks it brings. So, if it's too late for an inclusion in 7.0, I think I'll give up.
>
> So, could someone confirm what 'feature freeze' exactly means ?
>
> Regards
>
> François
>
>
>
>
>
>
>
>
>  The main issues are completeness (we can give hints for some cases, but not for others) and, more important, the compatibility with internal functions. As Andrea herself agreed, her mechanism for type hinting on internal functions is not sufficient. Just using the ZPP macros, as they exist today, won't work as a lot of internal functions get a bare zval and then convert it by themselves. So, in this case, we would check nothing. So, an argument described as 'string|array' in the documentation, wouldn't produce the same sort of error when sent an object, than its friend, described as 'string'. This is not consistent and will open a lot of side effects if it is left out of the type hint layer.

I have a sum types RFC that isn't ready for discussion. However, since
you have mentioned the functionality it here is the preliminary RFC:
https://wiki.php.net/rfc/sum_types.

Also, I know people REALLY want scalar types in PHP 7.0 but honestly
all we need to do is reserve the keywords so there is no BC impact and
then we can do it at any point during the PHP 7 lifecycle. This is my
preferred course of action, because right now this internals mailing
list is in HIGH STRESS MODE. I would rather just take the action of
reserving the types so it can be done in 7.1 (or 7.2 or even if it's
never, I would prefer to reserve these words).

---

## #82884 — francois@php.net — 2015-02-16T20:39:00+00:00

URL: https://externals.io/message/82863#82884 · In reply to: #82880

Hi,

> De : morrison.levi@gmail.com [mailto:morrison.levi@gmail.com] De la part
> 
> Also, I know people REALLY want scalar types in PHP 7.0 but honestly
> all we need to do is reserve the keywords so there is no BC impact and
> then we can do it at any point during the PHP 7 lifecycle. This is my
> preferred course of action, because right now this internals mailing
> list is in HIGH STRESS MODE. I would rather just take the action of
> reserving the types so it can be done in 7.1 (or 7.2 or even if it's
> never, I would prefer to reserve these words).

If we deprecate using bare class names as type hints and replace it with the 'object(classname)' syntax, we can reserve keywords for 7.0 and, maybe 7.1 but potential name clashes should be away in 7.2.

François

---

## #82885 — francois@php.net — 2015-02-16T20:50:28+00:00

URL: https://externals.io/message/82863#82885 · In reply to: #82878

> De : Pavel Kouril [mailto:pajousek@gmail.com]
>
> Hello,
> 
> I know this is probably a pretty unpopular opinion in PHP (based on
> the replies I got in the other thread), but different values for
> parameters should be IMHO solved by method overloading and such.

The question is not that it's unpopular, it's that 1. It requires strict types, and 2. If we want to solve this by polymorphism, we must also support polymorphism on functions. Now, tell me how you would solve the tan(int|float) case with polymorphism ? One 'tan' function for int, one for float ? str_replace(string|array, string|array, string|array, int &) is also a nice case to study if you can't sleep...

Sorry but polymorphism on scalar types is possible with strict types only, which is out of scope for the next RFC.

François

---

## #82891 — Philip Sturgeon — 2015-02-16T22:00:14+00:00

URL: https://externals.io/message/82863#82891 · In reply to: #82863

> Hi,
> > […]
>
> That's what I am planning. If I write an RFC, it will be based on Andrea's 0.1/0.2 version, and won't propose different modes.
>
> The problem is that the previous controversial RFC focused people on weak vs strict typing, while we should have explored other technical concerns. Here are the main ones I see :
>
> - the fact that the RFC supports single types only, like the previous 'return type' RFC. While it is easier to implement, it opens several issues as multiply-typed arguments are an integral part of the PHP language (mostly completeness and compatibility with internal function hinting). If we want to support multiple types the same way for internal and userspace functions, we must extend the ZPP layer to support it.
>
> - the mechanism to check for type hints on internal functions, while easy to implement, is not sufficient, as a lot of internal functions get a bare zval from the parsing system and then convert it by themselves. With the proposed mechanism, there's no possible hinting on such argument, which will make the implementation different from the documentation. Even if the check is done by the function body, it won't be done in a consistent way with type hinting checks and won't raise a similar error. As most cases are related to multiply-typed args, the solution is in adding multiply-typed support to ZPP. Multiply-typed support needs to redefine scalar conversion rules, to take care of the target type being a combination of single types.
>
> - We need to define the appropriate extension to Reflection parameters/return type. That's not complex, but it takes time.
>
> - Other changes I'd like to propose are exposed in Bob Weinand's article, at https://gist.github.com/bwoebi/b4c5564388ecd004ba96. The article explains how restricting weak conversion possibilities would make strict typing almost useless. Changes include forbidding bool to int/float or '7years' to int. This cannot be left for future additions as BC breaks will make it impossible. To remain consistent between userspace/internal functions, this must also be done at the ZPP level.
>
> - Using bare class names as type hints is a potential issue too, as it makes reserved keywords and class names share the same naming space. I think we should deprecate the use of class names as type hints in favor of 'object(class-name)'. If we don't do that, every future addition of a type hint keyword will cause a BC break (and will be practically impossible).
>
> - Additional 'hybrid' types like 'numeric' and 'mixed' should be also provided.
>
> So, most features I have in mind are really 'now or never'.
>
> My main concern, anyway, is with March 15 announced feature freeze. If we need a vote by this date, it's impossible. And planning such BC for 7.1 is probably unrealistic because of the huge syntax additions and BC breaks it brings. So, if it's too late for an inclusion in 7.0, I think I'll give up.
>
> So, could someone confirm what 'feature freeze' exactly means ?
>
> Regards
>
> François
>
>
>
>
>
>
>
>
>  The main issues are completeness (we can give hints for some cases, but not for others) and, more important, the compatibility with internal functions. As Andrea herself agreed, her mechanism for type hinting on internal functions is not sufficient. Just using the ZPP macros, as they exist today, won't work as a lot of internal functions get a bare zval and then convert it by themselves. So, in this case, we would check nothing. So, an argument described as 'string|array' in the documentation, wouldn't produce the same sort of error when sent an object, than its friend, described as 'string'. This is not consistent and will open a lot of side effects if it is left out of the type hint layer.
>
>
> --
> 
> 
>

I know it is very easy for people to say "Well, that v0.3 that I
didn't like has been withdrawn, so let's just crack on and do some
other new thing." but I would have to ask people to consider that v0.3
had two thirds majority, with a few people clearly admitting that
their No vote was down to declare.

So, if declare is the only thing blocking v0.3 from passing, despite
1/3rd of voters being sad about it, let's just go down that road
instead of throwing the baby out with the bath water and coming up
with some new approach that will be bike-shedded over until PHP 8 is
in feature freeze.

---

## #82892 — pajousek@gmail.com — 2015-02-16T22:00:42+00:00

URL: https://externals.io/message/82863#82892 · In reply to: #82885

> > […]
>
> The question is not that it's unpopular, it's that 1. It requires strict types, and 2. If we want to solve this by polymorphism, we must also support polymorphism on functions. Now, tell me how you would solve the tan(int|float) case with polymorphism ? One 'tan' function for int, one for float ? str_replace(string|array, string|array, string|array, int &) is also a nice case to study if you can't sleep...
>
> Sorry but polymorphism on scalar types is possible with strict types only, which is out of scope for the next RFC.
>
> François
>

I will get to this more tomorrow, but now just a short notes:

I'd only have tan(float) with int being able to be passed and the
value would be implicitly converted to float. This is something even
strongly typed languages normally do, and there is no reason PHP
shouldn't be able to. If somebody would make a tan(float) and tan(int)
declarations, then when calling tan($x), the apropriate one based on
current type of $x should be called. I don't see any reason why this
can be done only for strongly typed languages; could you name exact
reasons?

The str_replace(string|array $search, string|array $replace,
string|array $subject[, int &$count ]) is a harder one to comment on
though. I will refrain from answering on that one right now and will
get back to that one tomorrow, because that one needs a little bit
more thinking.

Regards
Pavel Kouril

---

## #82893 — francois@php.net — 2015-02-16T22:05:42+00:00

URL: https://externals.io/message/82863#82893 · In reply to: #82875

Hi Dmitry

De : Dmitry Stogov [mailto:dmitry@zend.com] 

> I would propose exactly Andrea's 0.1.
> Most people were agree to support weak type hints by default.
> This proposal won't prevent feature addition of optional strict type hints.
> All are tired from endless arguing.

Yes, but that's not exactly what I had in mind. I thought we could just use it as a base, and add features that, for any reason, will be much harder to implement in the future.

However, most of the work I want to do deals with ZPP macros, which are not so complex. And userspace type hints follow ZPP rules, so ZPP changes will apply to internal and userspace functions automatically. The first thing to do is restricting authorized parsing conversions (ZPP *and* zend_parse_parameters must matc here) to get approval from strict-typing fans (tan(1) and curl use cases must be solved first). Then, define multi-type conversion rules and implement that in ZPP (just ZPP, not zend_parse_parameters). Once it is available in ZPP, internal functions will migrate from  Z_PARAM_ZVAL at their own pace but the mechanism must exist before functions can gradually use it.

I would really like to implement multi-type support now. IMO, it is one of the most useful characteristics I expect from type hinting. Multi-typed argument are natural in PHP from the beginning and should have been part of the RFC from its beginning too. If people start describing multi-type args as 'mixed', which is not the same information, they won't come back and do the work again with more precise types, asking whether each 'mixed' is a 'real' mixed or just a placeholder waiting for us to implement the rest. I am especially concerned with the fact that a good part of userspace function arguments will be just impossible to type, except as 'mixed', which is not accurate in most cases. 3 lines above the argument declaration, a phpdoc comment says that $arg is 'string|array', but the user cannot transmit the information to the engine... I know it may be a question of time but it saddens me.

I propose you implement the parser/userspace part (I don't know what remains to be done) and I write and implement ZPP restrictions and multi-type support. I'll try to define ZPP restrictions (single type) tonight.

I'll also read the 0.1 RFC again and send comments if I have some. I already know that I want to add the 'resource' type because Andrea's argument is fake, IMO (and it would make it the only type without a hint).

> > […]
> It's a subject for separate more or less obvious RFC.

 Would feature freeze also apply to such work ?

Before I write anything, what do you think of suppressing conversions to/from IS_NULL in zpp (provided we support multi-typed args, of course ?

Regards

François

---

## #82894 — padraic.brady@gmail.com — 2015-02-16T22:11:51+00:00

URL: https://externals.io/message/82863#82894 · In reply to: #82891

> I know it is very easy for people to say "Well, that v0.3 that I
> didn't like has been withdrawn, so let's just crack on and do some
> other new thing." but I would have to ask people to consider that v0.3
> had two thirds majority, with a few people clearly admitting that
> their No vote was down to declare.
>
> So, if declare is the only thing blocking v0.3 from passing, despite
> 1/3rd of voters being sad about it, let's just go down that road
> instead of throwing the baby out with the bath water and coming up
> with some new approach that will be bike-shedded over until PHP 8 is
> in feature freeze.

Hear, hear.

--
Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
Zend Framework Community Review Team
Zend Framework PHP-FIG Representative

---

## #82898 — Andrey Andreev — 2015-02-16T22:38:46+00:00

URL: https://externals.io/message/82863#82898 · In reply to: #82875

Hi,


>
> I would propose exactly Andrea's 0.1.
> Most people were agree to support weak type hints by default.
> This proposal won't prevent feature addition of optional strict type hints.

Sorry, but I'll have to repeat what has been said over and over again
- the 0.1 version did not have overwhelming support and quite a lot of
people aren't OK with (only) weak type hints.

Part of the rationale behind the 0.2+ versions was that it would be
unfair to strict typing supporters if weak is accepted alone. I agree
with that on 100% (although I didn't agree with the proposed solution)
and it's not hard to imagine why ...

Also, IMO the only way a weak-types addition will NOT prevent strict
type-hints in the future is to use the foo((type) $bar) syntax that
was proposed by Anthony Ferrara 2 years ago. The syntax itself being
different from that of already existing class type-hints implies both
that it's a weak hint and that strict typing is expected to be
available in the future (although I see no reason to delay it). In no
other way excluding weird strict/weak modes or a regexp-like syntax
will you be able to add both features.

> All are tired from endless arguing.

That's not a reason to force-in a feature until it's clear that it is
what we all (or at least most) really want. I hated seeing so much
people supporting a proposal that they admit to not like, just so we
have something at all - I don't believe that's the right approach,
especially coming from tech people.

Cheers,
Andrey.

---

## #82899 — francois@php.net — 2015-02-16T22:50:06+00:00

URL: https://externals.io/message/82863#82899 · In reply to: #82891

> De : Philip Sturgeon [mailto:pjsturgeon@gmail.com]
>
> I know it is very easy for people to say "Well, that v0.3 that I
> didn't like has been withdrawn, so let's just crack on and do some
> other new thing.

It's not so easy. It would be easier to do as you suggest. And you can still do it in your name.

Andrea's had agreed we should write a follow-up RFC to solve open issues we had identified. This is what I am proposing here, nothing more.

It is not some 'other new thing'. It's mostly a way to bring strict-typing fans back to consensus. Of course, you may find it useless...

> " but I would have to ask people to consider that v0.3
> had two thirds majority, with a few people clearly admitting that
> their No vote was down to declare.

Even if we got 4 or 5 people change their mind because of a new declare syntax, it is clear that we don't have consensus on this topic. So, IMO, the RFC is dead, whatever 2/3 or 3/4 we may have. Once it was clear that both camps would never agree, with every PHP founders against it, pushing it was useless. We're not electing a president, we're trying to ensure we make the right decision. The spirit is not the same.

> So, if declare is the only thing blocking v0.3 from passing, despite
> 1/3rd of voters being sad about it, let's just go down that road
> instead of throwing the baby out with the bath water and coming up
> with some new approach that will be bike-shedded over until PHP 8 is
> in feature freeze.

I am also writing this because I think the two-mode approach is by far not the best one, as it would probably generate a lot of side effects we don't even imagine now. I voted 'yes' because I thought that was nice to have it in PHP 7 instead of nothing but, now, the RFC is dead and I am free to propose what I have in mind, especially in the hope that it can bring a consensus where it is lacking.

Once again, anyone can take over version 0.3, if it is so great. Why don't you do it ? I will play the game, stop working on my proposal, and vote 'yes' again. But don't ask me to do it in your place.

Regards

François

---

## #82903 — Dan Ackroyd — 2015-02-16T23:44:36+00:00

URL: https://externals.io/message/82863#82903 · In reply to: #82899

>  it is clear that we don't have consensus on this topic. So, IMO, the RFC is dead, whatever 2/3 or 3/4 we may have.

It's okay for people to disagree about things. And we have voting to
allow us to resolve those disagreements.

Claiming that only things that have near unanimous consensus can be
moved forward is bogus.

cheers
Dan

---

## #82906 — Sara Golemon — 2015-02-16T23:58:18+00:00

URL: https://externals.io/message/82863#82906 · In reply to: #82899

> Once again, anyone can take over version 0.3, if it is so great. Why don't you do it ?
> I will play the game, stop working on my proposal, and vote 'yes' again.
> But don't ask me to do it in your place.
>
If nobody else does it, I will.

I think Andrea's 0.3 proposal was extremely well balanced, served
everyone's needs whether they would admit it or not, and who's only
failing (subjectively termed) was the use of declare().  I think
declare() is fine and not nearly as ugly as some have slandered it to
be, but I'm willing to read the winds and modify it for v0.4.

Straw poll:
1) <?php strict;
2) <?php-strict
3) use strict; (psuedo-namespace)
3) <?php // strict (I don't actually like HHVM's style, but if you do...)
4) declare(strict=true); (As a top-level declare only)
5) declare(strict=true); (exactly as in v0.3 -- maybe you liked it)
6) your write-in vote here

I'm not going to scope in union types, nullables, or falsables.  We
can leave that for a followup RFC, this one is contentious enough as
it is.

-Sara

---

## #82908 — Arvids Godjuks — 2015-02-17T00:17:18+00:00

URL: https://externals.io/message/82863#82908 · In reply to: #82906

Might I remind everyone that time is not on our side here - feature freeze
is looming and actual work has to be done.
The part you must understand is: Strict type hints are possible if someone
cares to implement them with a next RFC. Be our guest. Right now we need to
sort out the basic stuff - the missing numeric/mixed/resource hints, the
ability to define mixed hints and make it all consistent. Maybe even
fix/change some of conversion rules as a result (i'm just giving an example
here).

Gives us some time to gather our thought, discuss stuff and do the update
to the RFC. Asuming stuff and pointing fingers before new version is out is
just distracting.

---

## #82909 — Nikita Popov — 2015-02-17T00:22:46+00:00

URL: https://externals.io/message/82863#82909 · In reply to: #82906

> On Mon, Feb 16, 2015 at 2:50 PM, François Laupretre <francois@php.net>
> wrote:
> > […]
> don't you do it ?
> > […]
> If nobody else does it, I will.
>
> I think Andrea's 0.3 proposal was extremely well balanced, served
> everyone's needs whether they would admit it or not, and who's only
> failing (subjectively termed) was the use of declare().  I think
> declare() is fine and not nearly as ugly as some have slandered it to
> be, but I'm willing to read the winds and modify it for v0.4.
>
> Straw poll:
> 1) <?php strict;
> 2) <?php-strict
> 3) use strict; (psuedo-namespace)
> 3) <?php // strict (I don't actually like HHVM's style, but if you do...)
> 4) declare(strict=true); (As a top-level declare only)
> 5) declare(strict=true); (exactly as in v0.3 -- maybe you liked it)
> 6) your write-in vote here
>
> I'm not going to scope in union types, nullables, or falsables.  We
> can leave that for a followup RFC, this one is contentious enough as
> it is.
>

Thank you for taking over.

I like "use strict" and "declare as top-level only" most. The "<?php
strict" variants feel too ad-hoc.

Nikita

---

## #82910 — Dan Ackroyd — 2015-02-17T00:35:57+00:00

URL: https://externals.io/message/82863#82910 · In reply to: #82909

>
> Thank you for taking over.
>
> I like "use strict" and "declare as top-level only" most.

That would be this no vote changed to a yes.

And I'd also like to say thank you Sara for taking over.

cheers
Dan

---

## #82911 — Rasmus Lerdorf — 2015-02-17T00:52:53+00:00

URL: https://externals.io/message/82863#82911 · In reply to: #82906

> 
> > […]
> If nobody else does it, I will.
> 
> I think Andrea's 0.3 proposal was extremely well balanced, served
> everyone's needs whether they would admit it or not, and who's only
> failing (subjectively termed) was the use of declare().  I think
> declare() is fine and not nearly as ugly as some have slandered it to
> be, but I'm willing to read the winds and modify it for v0.4.

I still disagree strongly that it serves everyone's needs. The internal
API and APIs provided by extensions are completely messed up by this
approach. Userspace authors get the choice when they write their code.
Even if the caller has turned on strict, if you haven't added strict
types to your functions/methods you are fine. Internal API and extension
authors don't get this luxury. If the caller turns on strict, then
suddenly an API that was written explicitly to make use of the coercive
characteristics PHP has had for 20+ years breaks and there is nothing I
can do about it as an extension author. This is beyond just int->float
coercion, which is, of course, also missing.

A simple example:

number_format($num);

So, for various inputs without strict enabled:

int(1000)
1,000

string(4) "1000"
1,000

float(1000)
1,000

string(5) "1000 "
Notice: A non well formed numeric value encountered in ...
1,000

string(5) " 1000"
1,000

string(9) "1000 dogs"
Notice: A non well formed numeric value encountered in ...
1,000

string(3) "dog"
Warning: `number_format()` expects parameter 1 to be float, string given
 `NULL` 

resource(5) of type (stream)
Warning: `number_format()` expects parameter 1 to be float, resource given
 `NULL` 

This is the intended API. The function does some sanity checking for
things that clearly don't make sense based on what it was written to do
and fails hard. It also lets the user know about questionable data and
relies on coercion for the rest. You could argue that the "1000 dogs"
case should be more severe than a notice, but that is pretty minor I
think. The extension author has the ability to make that more severe if
she likes.


Now turn on strict and we get:

int(1000)
 `number_format()` expects parameter 1 to be float, integer given

string(4) "1000"
 `number_format()` expects parameter 1 to be float, string given

float(1000)
1,000

string(5) "1000 "
 `number_format()` expects parameter 1 to be float, string given

string(5) " 1000"
 `number_format()` expects parameter 1 to be float, string given

string(9) "1000 dogs"
 `number_format()` expects parameter 1 to be float, string given

string(3) "dog"
 `number_format()` expects parameter 1 to be float, string given

resource(5) of type (stream)
 `number_format()` expects parameter 1 to be float, resource given

That in itself might not be so terrible, but also not terribly useful
and it is nothing like what the extension author had intended. And how
do you think users will deal with internal functions that are now
suddenly strongly typed even though they were not designed to be? Do you
think they will go look at the source code for the function and mimic
the data sanity checks and put those in their userspace code? Doubtful,
and as people on irc and everywhere have told me, they will just cast.
No big deal. So, we run the same set of data through with strict enabled
and doing a number_format((float)$num):

int(1000)
1,000

string(4) "1000"
1,000

float(1000)
1,000

string(5) "1000 "
1,000

string(5) " 1000"
1,000

string(9) "1000 dogs"
1,000

string(3) "dog"
0

resource(5) of type (stream)
5


Out of the 3 scenarios, this is inarguably the worst outcome with the
last line there being the most blatant. Actually outputting an internal
resource id as if it was a valid number to be formatted without the
slightest notice or warning anywhere that something is wrong in the code.

This is my fear with this approach. People will start littering their
code with casts and it will hide real bugs which is the complete
opposite of what motivated this in the first place.

Without more thought into how we properly deal with internal/extension
code I don't really understand how so many people foresee this to work
perfectly in the real world.

-Rasmus

---

## #82912 — Stelian Mocanita — 2015-02-17T00:54:27+00:00

URL: https://externals.io/message/82863#82912 · In reply to: #82910

Thanks Sara for taking over,

For myself both <?php strict would seal the deal, but use strict; is also
an option I would endorse.

Despite mentioning not scoping union types, I feel like a "numeric" type
would make a lot of sense and bring in more consensus to the list, fixing
the all famous `sin()` and such issues which I also see as a slight drudgery
to keep casting.

Regards,
Stelian



> 
> > […]
>
> That would be this no vote changed to a yes.
>
> And I'd also like to say thank you Sara for taking over.
>
> cheers
> Dan

---

## #82913 — Pierre Joye — 2015-02-17T01:20:51+00:00

URL: https://externals.io/message/82863#82913 · In reply to: #82875

>
> On Mon, Feb 16, 2015 at 7:42 PM, François Laupretre <francois@php.net>
> wrote:
>
> > […]
then we
> > […]
wanting
> > […]
a
> > […]
Andrea's
> > […]
>
> I would propose exactly Andrea's 0.1.
> Most people were agree to support weak type hints by default.

So a 50/50 vote is most people in favor of one type? Sorry, this is not the
case.

> This proposal won't prevent feature addition of optional strict type
hints.
> All are tired from endless arguing.

Yes, we are. The only difference is one camp makes compromises and tried to
find solutions. Now, deja vu scenario, we are heading exactly to what you
want because we do not have any other solution. A by default single choice
is not good. This is a very bad move.

---

## #82915 — Drew Paroski — 2015-02-17T01:44:34+00:00

URL: https://externals.io/message/82863#82915 · In reply to: #82911

> 
> > […]
>
> I still disagree strongly that it serves everyone's needs. The internal
> API and APIs provided by extensions are completely messed up by this
> approach. Userspace authors get the choice when they write their code.
> Even if the caller has turned on strict, if you haven't added strict
> types to your functions/methods you are fine. Internal API and extension
> authors don't get this luxury. If the caller turns on strict, then
> suddenly an API that was written explicitly to make use of the coercive
> characteristics PHP has had for 20+ years breaks and there is nothing I
> can do about it as an extension author. This is beyond just int->float
> coercion, which is, of course, also missing.
>
> A simple example:
>
> number_format($num);
>
> So, for various inputs without strict enabled:
>
> int(1000)
> 1,000
>
> string(4) "1000"
> 1,000
>
> float(1000)
> 1,000
>
> string(5) "1000 "
> Notice: A non well formed numeric value encountered in ...
> 1,000
>
> string(5) " 1000"
> 1,000
>
> string(9) "1000 dogs"
> Notice: A non well formed numeric value encountered in ...
> 1,000
>
> string(3) "dog"
> Warning: `number_format()` expects parameter 1 to be float, string given
> `NULL` 
>
> resource(5) of type (stream)
> Warning: `number_format()` expects parameter 1 to be float, resource given
> `NULL` 
>
> This is the intended API. The function does some sanity checking for
> things that clearly don't make sense based on what it was written to do
> and fails hard. It also lets the user know about questionable data and
> relies on coercion for the rest. You could argue that the "1000 dogs"
> case should be more severe than a notice, but that is pretty minor I
> think. The extension author has the ability to make that more severe if
> she likes.
>
>
> Now turn on strict and we get:
>
> int(1000)
> `number_format()` expects parameter 1 to be float, integer given
>
> string(4) "1000"
> `number_format()` expects parameter 1 to be float, string given
>
> float(1000)
> 1,000
>
> string(5) "1000 "
> `number_format()` expects parameter 1 to be float, string given
>
> string(5) " 1000"
> `number_format()` expects parameter 1 to be float, string given
>
> string(9) "1000 dogs"
> `number_format()` expects parameter 1 to be float, string given
>
> string(3) "dog"
> `number_format()` expects parameter 1 to be float, string given
>
> resource(5) of type (stream)
> `number_format()` expects parameter 1 to be float, resource given
>
> That in itself might not be so terrible, but also not terribly useful
> and it is nothing like what the extension author had intended. And how
> do you think users will deal with internal functions that are now
> suddenly strongly typed even though they were not designed to be? Do you
> think they will go look at the source code for the function and mimic
> the data sanity checks and put those in their userspace code? Doubtful,
> and as people on irc and everywhere have told me, they will just cast.
> No big deal. So, we run the same set of data through with strict enabled
> and doing a number_format((float)$num):
>
> int(1000)
> 1,000
>
> string(4) "1000"
> 1,000
>
> float(1000)
> 1,000
>
> string(5) "1000 "
> 1,000
>
> string(5) " 1000"
> 1,000
>
> string(9) "1000 dogs"
> 1,000
>
> string(3) "dog"
> 0
>
> resource(5) of type (stream)
> 5
>
>
> Out of the 3 scenarios, this is inarguably the worst outcome with the
> last line there being the most blatant. Actually outputting an internal
> resource id as if it was a valid number to be formatted without the
> slightest notice or warning anywhere that something is wrong in the code.
>
> This is my fear with this approach. People will start littering their
> code with casts and it will hide real bugs which is the complete
> opposite of what motivated this in the first place.
>
> Without more thought into how we properly deal with internal/extension
> code I don't really understand how so many people foresee this to work
> perfectly in the real world.
>
> -Rasmus
>

I think you bring up a good point, Rasmus. Extension implementations
have existed for many years in a world before user-land scalar
typehints. I can see how the author of an extension might have
written their code in a way that relies on assumptions about how
argument coercion behaves.

What would you say if zend_parse_parameters() API and friends were
left alone, and a new flag or new versions of these APIs were
introduced so that extension authors could gradually adopt the new
parameter checking/coercion scheme at their leisure?

When adopting the new parameter checking/coercion scheme, if an
author needs/wants to do something different for parameter checking
or coercion for a given extension, it occurred to me that they could
just omit the typehint (i.e. use "z" for zend_parse_parameters())
and then do manual checking inside the function's body. I've seen
this technique used in a number of extensions (and in pure PHP
functions) and it doesn't seem to cause significant problems AFAICT.

I know this isn't a fully baked solution to the issue you raise, but
I'm curious to hear your thoughts about this approach.

Regards,
Drew Paroski

---

## #82916 — Sara Golemon — 2015-02-17T01:57:31+00:00

URL: https://externals.io/message/82863#82916 · In reply to: #82911

> I still disagree strongly that it serves everyone's needs. The internal
> API and APIs provided by extensions are completely messed up by this
> approach. Userspace authors get the choice when they write their code.
> Even if the caller has turned on strict, if you haven't added strict
> types to your functions/methods you are fine. Internal API and extension
> authors don't get this luxury. If the caller turns on strict, then
> suddenly an API that was written explicitly to make use of the coercive
> characteristics PHP has had for 20+ years breaks and there is nothing I
> can do about it as an extension author. This is beyond just int->float
> coercion, which is, of course, also missing.
>
It's not your problem how a script author choses to use your function.
Is it a bug in PHP that currently I can call `number_format()` with an
object? No.  `number_format()` was written to take a float, and accepts
ints and numeric strings as a byproduct.

Adding the option on a per-file basis to make that call strict doesn't
change the intent or the usage of `number_format()`.  `number_format()`
still gets a float and still acts on that float in the same way.  All
that changes is whether passing an int or a numeric string is
considered "wrong" or not.

We can sigh and tut about this not being "the PHP way", but the script
author was the one who chose to enter into a tight contract, and the
script author, not you, is the one who should have that authority over
their own application.

> And how do you think users will deal with internal functions that are now
> suddenly strongly typed even though they were not designed to be?
>
I think they'll deal with it by dint of having /chosen/ to turn on
strict typing.  It's not as though an upgrade to PHP 7.12 suddenly
made all their code strict without warning.  In fact, nothing will
have changed for them at all UNLESS THEY EXPLICITLY ASK FOR IT.

> Do you think they will go look at the source code for the function and mimic
> the data sanity checks and put those in their userspace code?
>
No, they'll look at their own code and make a more informed decision
than any extension author can make for them.

> Out of the 3 scenarios, this is inarguably the worst outcome with the
> last line there being the most blatant. Actually outputting an internal
> resource id as if it was a valid number to be formatted without the
> slightest notice or warning anywhere that something is wrong in the code.
>
Again, you're assuming a single method call in a vacuum.  Is it
possible that the kind of script author who is turning on strict
typing might, in fact, be strict in the rest of their application?
Might, in fact, not try to pass a resource into a function expecting
float because they have the tools of strict typing available to them?

> This is my fear with this approach. People will start littering their
> code with casts and it will hide real bugs which is the complete
> opposite of what motivated this in the first place.
>
So let's talk compromise.
Would leaving internal functions out of the picture at this stage
change you mind?  This is effectively what Hack does, internal
functions are explicitly marked as "coercible".
Would a tri-state option make sense? ('weak-all',
'strict-user/weak-internal', 'strict-all')
How do we get from here to something you would like?

> Without more thought into how we properly deal with internal/extension
> code I don't really understand how so many people foresee this to work
> perfectly in the real world.
>
<kidding>This would be an opportune time for me to quote you as saying
you're really not that into languages. :)</kidding>

As I said above, I foresee this working well in the real world because
nobody is acting in a vacuum, there's an entire application's worth of
type-checked code going into it.

-Sara

---

## #82917 — francois@php.net — 2015-02-17T02:26:49+00:00

URL: https://externals.io/message/82863#82917 · In reply to: #82908

Arvids,

 

I’m afraid you’re still more naive than I am. Don’t you understand it’s dead ?

 

Even before Sara took over 0.3, they decided to revive Andrea’s v 0.1 with no change. The fight will take place between both. Our only right is to enlist in one camp and yell with the mass.

 

We intended to explore missing hints, union types, ZPP conversions. They just want to talk about the declare() syntax. Do you see the gap ? Oh yes, if you insist, you will be told all your concerns are premature. You will work on that later, when BC makes it impossible, or wait for 8.0.

 

I was surprised we could have a window to propose something creative, focusing on other concerns than this stupid declare() J. Imagine, we could have proposed something *without* a declare(). It would have been terrible. All this energy lost arguing about an unneeded directive ! Now, it’s clear. Declare() strikes back !

 

I know that’s frustrating but I also guess that our work would have been useless as everything would have been rejected. So, it may be better this way. Just enjoy the upcoming show. It has started already.

 

Regards

 

François

 

De : Arvids Godjuks [mailto:arvids.godjuks@gmail.com] 
Envoyé : mardi 17 février 2015 01:17
À : Sara Golemon; francois
Cc : Philip Sturgeon; Jefferson Gonzalez; Rowan Collins; PHP internals
Objet : Re: [PHP-DEV] Reviving scalar type hints

 

Might I remind everyone that time is not on our side here - feature freeze is looming and actual work has to be done.
The part you must understand is: Strict type hints are possible if someone cares to implement them with a next RFC. Be our guest. Right now we need to sort out the basic stuff - the missing numeric/mixed/resource hints, the ability to define mixed hints and make it all consistent. Maybe even fix/change some of conversion rules as a result (i'm just giving an example here).

Gives us some time to gather our thought, discuss stuff and do the update to the RFC. Asuming stuff and pointing fingers before new version is out is just distracting.

---

Next page: https://externals.io/message/82863.md?page=2
