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

Feature: Add RFC for new gencap, #write. #93

Merged
merged 1 commit into from
Jul 19, 2017
Merged

Conversation

jemc
Copy link
Member

@jemc jemc commented Jul 6, 2017

@jemc jemc force-pushed the feature/gencap-write branch from a38a1b7 to d09ba41 Compare July 6, 2017 02:12
@Praetonus
Copy link
Member

👍

@plietar
Copy link

plietar commented Jul 6, 2017

Sounds reasonable. Just a few points,

Do we also need an extra gencap for #write! = { ref, box, tag } ? (I can't think of any meaningful name for that set)
https://github.com/ponylang/ponyc/blob/master/src/libponyc/type/cap.c seems like we would need it

#read does not allow iso and trn even though they are readable, but #write would. This could be surprising (I was really confused as to why #read did not allow these when I started looking into generics)

Do we want a way to write the following, where this could be one of ref, trn or iso, depending on the receiver capability ?

fun #write replace(x: A) : this->A^ =>
  this.contents = consume x

@Praetonus
Copy link
Member

Do we want a way to write the following, where this could be one of ref, trn or iso, depending on the receiver capability ?

I think cases like that are already covered by automatic receiver recovery.

@jemc
Copy link
Member Author

jemc commented Jul 6, 2017

#read does not allow iso and trn even though they are readable, but #write would. This could be surprising (I was really confused as to why #read did not allow these when I started looking into generics)

Yeah, I remember being struck surprised by this as well. However, I'm not sure what could/should be done 🤔

Do we also need an extra gencap for #write! = { ref, box, tag } ? (I can't think of any meaningful name for that set)
https://github.com/ponylang/ponyc/blob/master/src/libponyc/type/cap.c seems like we would need it

Hm, I'm not sure where you think we need it. You're probably right, and I'm probably wrong, but I already implemented my first draft of this in a branch, and didn't use such a set. We should go over this again in code review for the implementation.

@plietar
Copy link

plietar commented Jul 6, 2017

Do we want a way to write the following, where this could be one of ref, trn or iso, depending on the receiver capability ?

I think cases like that are already covered by automatic receiver recovery.

I was thinking more about reflecting the receiver capability in the this viewpoint, but I've realised ref is the most flexible viewpoint anyway, so there's not much point doing that.

Do we also need an extra gencap for #write! = { ref, box, tag } ? (I can't think of any meaningful name for that set) https://github.com/ponylang/ponyc/blob/master/src/libponyc/type/cap.c seems like we would need it

Hm, I'm not sure where you think we need it. You're probably right, and I'm probably wrong, but I already implemented my first draft of this in a branch, and didn't use such a set. We should go over this again in code review for the implementation

I'm talking about the cap_aliasing function, which takes a (gen)cap and returns its alias. Today, all existing gencap have a alias (#any->#alias, #send->#share, others don't change), but #write would not.

This can be seen as an implementation detail, with a #writealiased gencap if it is indeed necessary, which wouldn't have to be expose to source programs.

I've always seen this is the reason #alias exists. The documentation says something about it being only useful internally in the compiler.

@jemc
Copy link
Member Author

jemc commented Jul 12, 2017

I'm putting this into final comment period.

Will address @plietar's concern in the implementation, and we can discuss it more in the PR - I don't think we want to add another user-facing gencap to accomodate #writealiased - if we need another such gencap it should be an implementation detail as he suggested.

@jemc jemc added the status - final comment period The RFC is finalized. Waiting for final comments. label Jul 12, 2017
@SeanTAllen SeanTAllen added status - ready for vote The RFC is ready to be voted on. and removed status - final comment period The RFC is finalized. Waiting for final comments. labels Jul 19, 2017
@SeanTAllen SeanTAllen merged commit 3c54ac7 into master Jul 19, 2017
@SeanTAllen SeanTAllen deleted the feature/gencap-write branch July 19, 2017 19:36
@Theodus Theodus removed the status - ready for vote The RFC is ready to be voted on. label Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants