We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently named parameters with default values often become useless as explicitly passing null stops the default occurring.
For example
foo({String blah: 'blah'}); bar({String blah}) => foo(blah: blah);
If blah is null into bar then it will pass that to foo and the default value not used
So in practice you end up needing to do
foo({String blah}) { if (blah == null) blah = 'blah' }
This seems to happen so often as to almost render defaults on named parameters fairly useless.
Does this proposal provide any help for this case?
Does it need extra sugar? Dare I suggest
foo(blah ?: possiblyNullValue);
where the semantics are if possiblyNullValue is null then don't set the named parameter blah to method foo (leave it to default)
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
No branches or pull requests
Currently named parameters with default values often become useless as explicitly passing null stops the default occurring.
For example
If blah is null into bar then it will pass that to foo and the default value not used
So in practice you end up needing to do
This seems to happen so often as to almost render defaults on named parameters fairly useless.
Does this proposal provide any help for this case?
Does it need extra sugar? Dare I suggest
where the semantics are if possiblyNullValue is null then don't set the named parameter blah to method foo (leave it to default)
The text was updated successfully, but these errors were encountered: