New issue
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
Foo:D type on attribute should imply 'is required' and not need intialiser #4615
Comments
From @ilmariOr to put another way: attributes with 'is required' should not need an The first and second examples below should be equivalent. > class { has Int:D $.count }.new(count => 42) > class { has Int:D $.count is required = Int }.new(count => 42) And the error message should probably be this: > class { has Int $.count is required }.new() Rather than this: > class { has Int:D $.count is required = Int }.new() -- |
From @FROGGSI don't think that we should mix two concepts here. The type constraint of an attribute just tells us what types/subsets are allowed to be contained in the attribute. That an attribute should be passed when instantiating an object (maybe passed but undef?) is another story. And this has not much to do with definedness of an attribute. |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetOn Thu, 08 Oct 2015 03:12:02 -0700, ilmari wrote:
On Thu, 08 Oct 2015 07:34:43 -0700, FROGGS.de wrote:
Agreed. Especially since `is default` trait can be used, making the cases where It's possible the user intended to "accept only definite values" without realizing
Exactly that (required + default) should actually throw, the same as it does with Without the default, the error is (and was, when issue was opened) the same for :D and :_ types |
@zoffixznet - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#126296 (status was 'rejected')
Searchable as RT126296$
The text was updated successfully, but these errors were encountered: