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

Collection clone methods should return iso when A is sharable. #1784

Open
jemc opened this issue Mar 30, 2017 · 4 comments
Open

Collection clone methods should return iso when A is sharable. #1784

jemc opened this issue Mar 30, 2017 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jemc
Copy link
Member

jemc commented Mar 30, 2017

It's a quite common pain point in Pony that arrays of #shareable objects (val or tag) cannot be cloned to iso or val, as would be expected (and is the case with String.clone). This isn't possible because doing so would be unsafe when A is not #shareable.

This violates principle of least surprise for a lot of our users and we've received three PRs so far of users who were so surprised that they filed a PR to change it (including me, when I was first getting involved with the project). See #279, #1360, #1782.

However, once we have specialization (#1410) we can implement Array.clone so that it returns iso when A <: Any #share, or ref otherwise (as it does now). Doing so would seamlessly resolve the issue for users in the least surprising way.

@jemc
Copy link
Member Author

jemc commented Mar 30, 2017

Marking this a medium-priority bug, blocked until #1410 is implemented.

@jemc jemc changed the title Array.clone should return iso when A is sharable. Collection clone methods should return iso when A is sharable. Mar 30, 2017
@jemc
Copy link
Member Author

jemc commented Mar 30, 2017

Changing the name of the ticket, since this applies not only to Array, but all other collections with a clone method as well (List, Map, Set, etc...). Noticed this because my original PR for this issue (#279) included them all.

@SeanTAllen
Copy link
Member

This is currently blocked

@SeanTAllen SeanTAllen added the help wanted Extra attention is needed label Sep 5, 2020
@jemc
Copy link
Member Author

jemc commented Apr 25, 2021

I've written a somewhat lengthy explanation in Zulip about what's going on with the signature of Array.clone. Maybe it will be helpful to someone reading this ticket, so I'll link to it here: https://ponylang.zulipchat.com/#narrow/stream/189985-beginner-help/topic/Debug.28.29ing.20an.20iso.20passed.20through/near/236037204

@SeanTAllen SeanTAllen removed the bug label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants