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

Make Map#{mapValues, filterKeys} strict #11245

Open
shawjef3 opened this issue Nov 5, 2018 · 7 comments
Open

Make Map#{mapValues, filterKeys} strict #11245

shawjef3 opened this issue Nov 5, 2018 · 7 comments

Comments

@shawjef3
Copy link

shawjef3 commented Nov 5, 2018

This is a followup for #10919.
Is to be done for version 2.13.1 or 2.14?

@joshlemer
Copy link

This is to be done in 2.14 at the earliest, because to change them in 2.13.1 would mean to break binary compatibility.

@shawjef3
Copy link
Author

shawjef3 commented Nov 5, 2018

Ah, of course. Although it wouldn't break binary compatibility if mapValues and filterKeys were to return a Map rather than a MapView, yes? The type wouldn't reflect the laziness, but we could change it sooner. The @deprecated warning would notify the user that it's lazy.

@Jasper-M
Copy link

Jasper-M commented Nov 5, 2018

It would break semantic compatibility, if that's a thing.

@shawjef3
Copy link
Author

shawjef3 commented Nov 5, 2018

I've been burned by mapValues being lazy, and so I consider it a performance bug. I'm happy there's a plan to make it strict for 2.14. 2.13 would be better but I understand the motivation to be careful. Since I consider it a bug I don't feel the need to be careful.

For why I feel so strongly about mapValues: com-lihaoyi/fastparse#70

@Jasper-M
Copy link

Jasper-M commented Nov 5, 2018

Agreed that it's great that this will change, but by now a lot of people are aware that mapValues is lazy and use it accordingly.

@NicolaeNMV
Copy link

NicolaeNMV commented Jun 16, 2021

.mapValues got deprecated without a good alternative and no plan when exactly this will be addressed ?

In the previous thread @szeiger wrote:

Maybe we can make the versions on Map strict in 2.14 after a deprecation cycle without removing them first?

Is this still on track ?

Just making sure that this issue is not abandoned. Because it looks like it is abandoned. It's really painful that mapValues now needs .view.mapValues(f).toMap every time. People switched to .transform that is a lot less readable.
Thanks.

@SethTisue
Copy link
Member

SethTisue commented Jun 16, 2021

@NicolaeNMV the situation hasn't changed: as per https://www.scala-lang.org/2019/12/18/road-to-scala-3.html and scala/scala-dev#661 and Josh's remark above, we aren't free to add new methods to the Scala standard library in the 2.13.x and 3.0.x series (or to drastically alter the semantics of existing methods). Meanwhile, this ticket remains open and is milestoned appropriately. (I've renamed the old "2.14.0-M1" milestone to "3.x".)

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

No branches or pull requests

5 participants