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
is rw
on anon parameter causes "inconsistent bind result" error
#6366
Comments
From @zoffixznetWorks as expected: Doesn't: |
From @lizmatShouldn’t: sub ($ is rw) { } be a compile-time error? I mean, there is no way to actually assign to the anonymous variable, is there? So there is no point in the “is rw”. So most likely indicates a typo on the user side.
|
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetOn Thu, 29 Jun 2017 00:45:02 -0700, elizabeth wrote:
Feels a bit of an overreach to make that judgement. What if I don't want to assign anything to it, but just want to force the user of my sub to use a writable container? There might be a usecase for wanting that. While typoing a variable name would be easily detected via another error, when the user tries to use the variable in the body. For example, I can multi-dispatch based on that and it works right: <Zoffix__> m: multi foo ( Or I want to unpack only iterables with writable containers, while grabbing all but one item, which actually seems to have another bug in it in that the anon doesn't force rw at all: <Zoffix__> m: sub foo (@ ($x is rw, |c)) { say c }; foo (42, 42) |
From @zoffixznetOn Thu, 29 Jun 2017 03:13:07 -0700, cpan@zoffix.com wrote:
Here's a less convoluted example for the last usecase. Taking an iterable with 2 rw containers, while not necessarily wanting to assign each of the items into their own variables. I'd expect the first example to error out just like the last example instead of accepting the values (or dying with inconsistent bind error): <Zoffix__> m: sub foo (@a ($ is rw, $ is rw)) { $_++ for @a }; my @a := 42, 42; foo @a; dd @a |
From @jnthnOn Wed, 28 Jun 2017 16:05:50 -0700, cpan@zoffix.com wrote:
Fixed and tested in S06-traits/is-rw.t. |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#131673 (status was 'resolved')
Searchable as RT131673$
The text was updated successfully, but these errors were encountered: