jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
obadz- has joined #ponylang
obadz has quit [Ping timeout: 248 seconds]
obadz- is now known as obadz
obadz- has joined #ponylang
obadz has quit [Ping timeout: 246 seconds]
obadz- is now known as obadz
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
Praetonus has quit [Quit: Leaving]
DARKAV has quit [Ping timeout: 260 seconds]
Acorn2 has joined #ponylang
<Acorn2> Hello. I have some basic use-case questions about Pony's capabilities after reading the tutorial documentation, if anyone here has a few minutes.
<Acorn2> I am curious to understand the scenarios where it is useful to specify trn or box on an alias
<Acorn2> If there is a link to a post or document about this, that would also be helpful. Thank you
* endformationage will take a stab, others will surely clarify.
<endformationage> Acorn2: trn is super useful for creating objects that need to be further initialized / otherwise mutated before they need to be sent off to other actors, such as data structures.
<endformationage> Before sending a trn, it is consumed to a sendable reference capability, generally val.
<Acorn2> So do you start with a trn, or with an iso? And I assume it has to be recovered as an iso before it can be sent to another actor
<Acorn2> Ah, ok
<Acorn2> Does one of the Pony libraries or other code snippet demonstrate this use of trn?
<endformationage> Yes, let me find an example..
<Acorn2> I appreciate this help very much
<Acorn2> Perfect, that is so helpful
<Acorn2> And I assume box is good for a function parameter that you do not intend to change, without any prerequisite knowledge about whether someone else can mut it
<endformationage> The story with the HTTPClient's apply method id this..
<endformationage> It accepts a request Payload tr, which it must modify to add a session to before returning it as val to the caller.
<endformationage> * Payload trn
<endformationage> It consumes the request into a valrequest: Payload val here: https://github.com/ponylang/ponyc/blob/54225e41bd141b8b7a64f0e65d3dbe46bc5317d4/packages/net/http/payload.pony#L89
<endformationage> becuase it needs to send it both to the session and return it to the caller, something that cannot be done with an iso Payload.
<Acorn2> makes sense, I see that
<endformationage> .. or a ref because it is across actors.
<endformationage> Now, before you would send the Payload to the HTTPClient, you create one via Payload.request()
<endformationage> Notice it returns the Payload to you iso
<endformationage> You consume this payload to the client's apply method when you're ready, and it's ref caps are turned into that of trn for the parameter.
<Acorn2> yup - that flow makes sense. How valuable to see it playing out with a specific use case
<endformationage> Notice furthermore, Payload it defined trn at the class level as well.
<Acorn2> Very helpful. Thank you.
<Acorn2> And box?
<endformationage> box is the defualt ref cap for the receiver on methods.
<Acorn2> ah okay - I hoped it would be that simple
<endformationage> As far as I can tell that's where it's useful, so that a method can operate on different readable receivers (I think)
pecan has joined #ponylang
<endformationage> I used box on the params to a method once to get something working recently, but it had bad code smell, and I chnaged things around to get it working without.
<Acorn2> interesting
<endformationage> If you can't tell, I don't fully understand it all either, but I'm getting better.
<Acorn2> The best way to get comfortable is by coding with it, which I need to spend more time doing. Your answers were very helpful Thank you
<endformationage> As you might conclude, it comes up fairly often, and there's some great (mush better than mine) explainations in the chat logs
<endformationage> This should help:
<Acorn2> well this is my first time here. If it is a frequent question, I hope someone posts a helpful guide somewhere as a post or part of the Pony documentation.
<Acorn2> the turorial is very good and clear on the concepts. Sometimes it takes a while to translate concepts to sweet-smelling code
<Acorn2> whoa - someone did. Cool!
<endformationage> The link I just posted has some good examples of trn
<endformationage> Authored by doublec, whose explaination no doubt eclipse mine
<Acorn2> very helpful. Again, thanks
<endformationage> See also his other Pony articles as tagged
<endformationage> You'll see that similar things can be done with iso, but are a bit more verbose than with trn
<Acorn2> :-)
<endformationage> Anyway, thanks for taking on my rambling attempt at explaining some difficult concepts. I'll leave you to read!
<endformationage> ps, the playground is quite helpful to play around: https://playground.ponylang.org/
abeaumont has quit [Ping timeout: 246 seconds]
abeaumont has joined #ponylang
vaninwagen has joined #ponylang
atk has quit [Quit: Well this is unexpected.]
atk has joined #ponylang
endformationage has quit [Quit: WeeChat 1.9]
samuell has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
samuell has quit [Quit: Leaving]
vaninwagen has quit [Ping timeout: 260 seconds]
Matthias247 has joined #ponylang
samuell has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
Praetonus has joined #ponylang
coopernurse has joined #ponylang
<SeanTAllen> Acorn2: there's a lot of links to good content in the "planet pony" section of the website: https://www.ponylang.org/community/planet-pony/
plietar has joined #ponylang
endformationage has joined #ponylang
theodus has joined #ponylang
samuell has quit [Quit: Leaving]
inara has quit [Quit: Leaving]
inara has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
samuell has joined #ponylang
samuell has quit [Read error: Connection reset by peer]
samuell has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 260 seconds]
samuell has quit [Quit: Leaving]
<Acorn2> SeanTAllen: Thank you for that link. I am beginning to get a handle on it, bit by bit
_andre has quit [Quit: leaving]
<SeanTAllen> glad to help Acorn2
<SeanTAllen> hopefully can help more in the future
<SeanTAllen> btw Acorn2, we have a blog series called "My First Pony" where we try to get folks to write about their first week or two using Pony. if you would be interested in contributing one, let me know
<Acorn2> SeanTAllen: I appreciate that. Will let you know. Atm, am frying a different fish - incorporating Pony's capability model within a larger memory management technique
<Acorn2> SeanTAllen: That said, I am very impressed by Pony and look forward to playing with it when I have a chance. One of the most exciting languages around imo
<SeanTAllen> Awesome. We thank you for your kind words.
Praetonus has quit [Quit: Leaving]
<achamber1> The file access capabilities is really neat
<achamber1> I can imagine designing an application with an internal auth/permission actor for dishing out access
<achamber1> though for now I just pass ambient auth everywhere haha
theodus has quit [Remote host closed the connection]
<Acorn2> achamber1: I believe that approach is what the Microsoft Midori team did to surface OS resource capabilities to programs