-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Receiver capabilities of constructors not documented #212
Comments
Actually, this one isn't a requirement. The reason we have that requirement for For |
Thoughts on where this would go @jemc? |
Assuming class fields can’t be assigned from in a constructor (and noting that assigning from sendable arguments to non-sendable arguments is illegal), then I presume one of the reasons for not making an exception for constructor arguments which are only assigned to instead of assigned from, is because constructors really shouldn’t be encouraged to have side-effects? If so, then for consistency shouldn’t constructors (of all capability types) be forced to never assign to input arguments (or at least those which aren’t assigned from)? I contemplated whether Pony has a feature to enforce referential transparency orthogonal to necessary degrees-of-freedom for reference capabilities. I pondered whether a function that takes mutable reference capabilities could possibly be referentially transparent. Contemplated whether conflating reference capabilities and referential transparency invariants would reduce degrees-of-freedom. Although a function which leaks a mutable reference capability in its return value is I guess not referentially transparent because the return value can mutate. Thus I guess |
@SeanTAllen - I'm not sure the best place to put this, to be honest. We introduce methods and the idea of We probably need to add a new page to the "Reference Capabilities" section called "Receiver Capabilities" we talk about how receiver capabilities work in detail, for both |
Great issue!
Closest mention of receivers is in viewpoint adaptation:
tutorial.ponylang.io/reference-capabilities/arrow-types.html
I think this needs to be after the introduction of refcaps and before
viewpoint adaptation so perhaps around "Passing and Sharing References" is
a good fit? Start with (re)emphasis that anything which can be assigned to
a variable has a refcap and therefore when calling methods there is an
implied access to the receiver -- then this would allow discussion of
constructors without seeming out of place by stating the constructor sets
the capabilities of the receiver.
I recall a conversation on Zulip about this being undocumented. (Will need
to snag the link later). That might help steer how people think about this
idea before they know how it is really done.
…On Mon, Jun 15, 2020, 11:51 AM Joe Eli McIlvain ***@***.***> wrote:
@SeanTAllen <https://github.com/SeanTAllen> - I'm not sure the best place
to put this, to be honest. We introduce methods and the idea of fun ref
very early in the tutorial before we talk about reference capabilities at
all, and we never really come back to talking about how receiver
capabilities work in detail, for either for fun or new.
We probably need to add a new page to the "reference capabilities" section
called "receiver capabilities" we talk about how receiver capabilities work
in detail, for both fun and new.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#212 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJJ6P74TN6AYMYHYUJXSI3RWZGSXANCNFSM4DU27PLQ>
.
|
new ref create()
should be explained.new val create()
would only accept sendable arguments. This should also be documented.I assume thatfun val foo()
would also only accept sendable arguments. I don't think this is documented either.The text was updated successfully, but these errors were encountered: