Skip to content
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

Locale objects return references to internal data structures, not copies #10

Open
autarch opened this issue Nov 12, 2016 · 2 comments
Open
Labels

Comments

@autarch
Copy link
Member

autarch commented Nov 12, 2016

Migrated from rt.cpan.org #65717 (status was 'new')

Requestors:

From [email protected] on 2011-02-14 17:20:29:

use DateTime;
my $cldr = DateTime::Locale->load('en');
my $weekdays = $cldr->day_format_abbreviated();
my $sun = pop @$weekdays;
print join ',', @{$cldr->day_format_abbreviated()};

Shouldn't the DateTime::Locale methods return a copy of the array?

It doesn't seem right that manipulating the return of day_format_abbreviated() should affect the result of future invocations of that function.

@ccntrq
Copy link
Contributor

ccntrq commented Aug 29, 2020

In #26 the performance impact of fixing this by returning a copy of the data was discussed. We concluded that the performance hit is not worth it. The behavior described here hast been documented in 272bcae.

I think this is closable. @autarch?

@autarch
Copy link
Member Author

autarch commented Aug 29, 2020

The issue it describes is still a thing, so I'll leave it open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants