You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
list($a, $b) on a tuple is always going to work. The typechecker knows that your tuple has two elements. When operating on a vec, the typechecker says, I'll trust you have checked the length somehow, since the length is not part of the type information.
The reason why using list on a vec is not recommended, is because people who are used to the tuple use case don't expect an OutOfBoundsException to be thrown from a list construct when the vec has fewer elements that the list construct has parts.
The example with the loop is not using list on the vec itself. It is using it on every element, which are tuples. Think list($a, $b) = $vec_of_tuples[0] instead of list($a, $b) = $vec_of_tuples.
As for your nit about "My personal favorite place", this was added in this PR by Lexidor.
Please complete the information below:
Where is the problem?
https://docs.hhvm.com/hack/expressions-and-operators/list
"You may also use list() on a vec, but it is not recommended."
What is the problem?
Please don't change anything below this point.
The text was updated successfully, but these errors were encountered: