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
no implicit $; for slices #12592
Comments
From @cpansproutI was trying to take advantage of the $; variable, writing code like this: $seen{@$_{<type id>}}++ but it didn’t work. It was equivalent to $seen{$_->{id}}. I looked at the code in op.c, and it adds the implicit join $; if the parameter is an OP_LIST. This means that this does what I wanted: $seen{(),@$_{<type id>}}++ That can be very confusing. But how should this be fixed? Or should this be fixed? If we change it to imply join $; for slices, that would solve this particular case, but should these behave differently? $seen{foo()} Flags: Site configuration information for perl 5.17.6: Configured by sprout at Sat Nov 17 23:09:15 PST 2012. Summary of my perl5 (revision 5 version 17 subversion 6) configuration: Locally applied patches: @INC for perl 5.17.6: Environment for perl 5.17.6: |
From @davidnicolOn Sun, Nov 18, 2012 at 4:42 PM, Father Chrysostomos <
Yes, those should behave differently, and wantarray() within sub foo will As someone who uses $; often, I've found myself doing things like { my $listref = $_{<type id>}; regularly, after getting reminded about the syntactical requirement for a In my opinion this is not a bug to fix, but rather a best practice to Using an explicit intermediary is clearer for the maintainer, and moving Prepending an empty list seems like an elegant way to listify an array; the $seen{(),@elements}++ seems more elegant than $seen{$elements[0],@elements[1 .. $#elements]}++ |
The RT System itself - Status changed from 'new' to 'open' |
From @maukeOn 26.11.2012 22:35, David Nicol wrote:
If we're going for clarity/maintainability, how about -- |
From zefram@fysh.orgWe shouldn't change the rules for implicit $; usage. The current -zefram |
From @xsawyerxOn Sun, 19 Nov 2017 01:49:50 -0800, zefram@fysh.org wrote:
To be honest, I would already be weary of seeing implicit |
From @cpansproutOn Sun, 19 Nov 2017 06:45:28 -0800, xsawyerx@cpan.org wrote:
If you don’t mind: s/wea/lee/
I hope you are not proposing that this feature be removed. I have since gotten into the habit of writing ‘(),’ to force a list, and removing the feature will break my code. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Sun, 19 Nov 2017 06:45:28 -0800, xsawyerx@cpan.org wrote:
If you don’t mind: s/wea/lee/
I hope you are not proposing that this feature be removed. I have since gotten into the habit of writing ‘(),’ to force a list, and removing the feature will break my code. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'rejected' |
From @cpansproutOn Sun, 19 Nov 2017 12:33:50 -0800, sprout wrote:
Or: wary -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Sun, 19 Nov 2017 12:33:50 -0800, sprout wrote:
Or: wary -- Father Chrysostomos |
From @xsawyerxOn 11/19/2017 09:33 PM, Father Chrysostomos via RT wrote:
Meant "wary," but "leery" will do as well. Sorry.
Not at all, but this ticket suggested also extending $; for slices to be |
Migrated from rt.perl.org#115812 (status was 'rejected')
Searchable as RT115812$
The text was updated successfully, but these errors were encountered: