Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
1
-
Language 2016-02-24
-
New Feature
-
Should be in the release notes together with the fix for
PUP-5925.
Description
In PUP-5925 we made it possible to give an undef value in a data binding and allowing that to mean that undef is assigned to a class parameter if that class parameter does not have a default value expression (a default expression wins using the rule "an undef given value means 'use the default").
This ticket asserts that we have the same behavior for a given undef - e.g.:
define foo(Optional[Integer] $x) { } |
foo { 'example': x => undef } |
if executed this would not fail, and the user would get $x set to undef (just what PUP-5925 achieves).
This means that the semantics changes from "use the default" to "use the default if there is one" . Since we now have typing, a user can protect against unwanted undef by using a type that does not accept undef for that parameter.
This DOCs note is to ensure that this is documented correctly. (The implementation has worked this way for some time in the 4.x series).