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
codec1 has quit [Read error: Connection reset by peer]
codec1 has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
aturley has quit [Read error: Connection reset by peer]
aturley has joined #ponylang
jemc has quit [Ping timeout: 246 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
jemc has joined #ponylang
nisanharamati has quit [Quit: Connection closed for inactivity]
jemc has quit [Ping timeout: 256 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 256 seconds]
gokr has quit [Ping timeout: 240 seconds]
TheNet has quit [Quit: Textual IRC Client: www.textualapp.com]
mahmudov has quit [Quit: Leaving]
mahmudov has joined #ponylang
jemc has joined #ponylang
mahmudov has quit [Ping timeout: 240 seconds]
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
mahmudov has joined #ponylang
khan has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
khan has quit [Quit: khan]
dougmacdoug has joined #ponylang
khan has joined #ponylang
<dougmacdoug> is there a flag for unit tests to for TestHelper.log to print even if the test passes?
mahmudov has quit [Ping timeout: 260 seconds]
khan has quit [Client Quit]
khan has joined #ponylang
jemc has joined #ponylang
khan has quit [Quit: khan]
khan has joined #ponylang
khan has quit [Client Quit]
khan has joined #ponylang
<endformationage> dougmacdoug: The --verbose commandline option will show test passes, according to the docs on the TestHelper log function.
<endformationage> Just realized you can pass --help to your test exec for a full option list.
<dougmacdoug> thanks
johshoff has quit [Ping timeout: 268 seconds]
dougmacdoug has quit [Quit: Page closed]
endformationage has quit [Quit: WeeChat 1.9.1]
codenoid has joined #ponylang
<codenoid> helo pony land
<codenoid> how i can do getter and setter in pony ?
khan has quit [Quit: khan]
gokr has joined #ponylang
codec1 has joined #ponylang
<codec1> codenoid, you can use just normals functions for that
codenoid has quit [Ping timeout: 256 seconds]
codenoid has joined #ponylang
codenoid has quit [Ping timeout: 240 seconds]
codenoid has joined #ponylang
_andre has joined #ponylang
johshoff has joined #ponylang
abeaumont has quit [Remote host closed the connection]
codec1 has quit [Quit: Leaving.]
codec1 has joined #ponylang
milisarge has quit [Ping timeout: 240 seconds]
codenoid has quit [Ping timeout: 260 seconds]
mahmudov has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
khan has joined #ponylang
codec1 has joined #ponylang
jemc has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
gokr has left #ponylang [#ponylang]
mahmudov has quit [Remote host closed the connection]
gokr has joined #ponylang
NotARobot__ has joined #ponylang
NotARobot__ has quit [Client Quit]
<codec1> Hi, can someone help me with this one? https://is.gd/PtogwC
dougmacdoug has joined #ponylang
dougmacdoug has quit [Remote host closed the connection]
dougmacdoug has joined #ponylang
endformationage has joined #ponylang
gokr has left #ponylang [#ponylang]
jemc has joined #ponylang
codec1 has quit [Read error: Connection reset by peer]
codec1 has joined #ponylang
jemc has quit [Ping timeout: 256 seconds]
jemc has joined #ponylang
ficl has joined #ponylang
milisarge has joined #ponylang
<rirc_187A> codec1: you still here?
ficl has quit [Ping timeout: 240 seconds]
<rirc_187A> thats not how recover works, if you think about it: if you were allowed to do that then you could create a val from any ref which is clearly not safe
<rirc_187A> it will work if you create the ref inside the recover expression
<codec1> still here
codenoid has joined #ponylang
<codec1> could explain this one?
bimawa2 has quit [Ping timeout: 252 seconds]
codenoid has quit [Read error: Connection reset by peer]
codenoid has joined #ponylang
<rirc_187A> codec1: I don't really know why bytes is an iso! there. I gtg now, I will look at this again tomorrow.
codenoid has quit [Quit: Leaving]
<SeanTAllen> codec1: a_byte and bytes.values() return different values
bimawa2 has joined #ponylang
<codec1> SeanTAllen what do you mean?
<SeanTAllen> a_byte is not the same type as the iterator returned by bytes.values()
<SeanTAllen> bytes.values returns an Iterator of some type A
<SeanTAllen> a_byte is some type A
<codec1> ok, but the thing I am trouble with is in the other part
<codec1> basically I want to fill an array before giving it to the reader
<codec1> the for loop does the trick but before that I tired with the concat (or append for that matter) methods
<codec1> and couldn't get them working
<codec1> I understand that concat need a ref receiver in order to mutate the array and append expect a val
<codec1> so my best guess was that I could start with an iso array, fill it using concat, and then consume it in the call to rb.append
<codec1> but the compiler tell me that the receiver for concat is an iso! and not an iso, which I don't understand since for me there is no alias there
<codec1> *tried (instead of tired)
<SeanTAllen> what did you do with append @codec1?
<codec1> just trying to call it with the array as a receiver
<SeanTAllen> can you paste some code for what you did specifically?
<codec1> basically the not commented code is fine to me, and I am fighting the compiler when un commenting the line
<codec1> and for context I went with the for loop instead only because it was the only thing that did both compiled and did what I wanted (filling the array)
<SeanTAllen> sorry, that is still concat not append
<SeanTAllen> can you post what you did where append didnt work?
<codec1> well I just tried to replace concat by append
<codec1> and it didn't worked either
<codec1> I thought the parameter were the same, but I am not so sure of it now
<SeanTAllen> they arent the same.
<SeanTAllen> concat takes an iterator
<SeanTAllen> append takes an A
<SeanTAllen> sorry it takes a ReadSeq[A]
<codec1> yeah right, so with append my attempt would be that
<SeanTAllen> so i can make this work with append but not concat
<SeanTAllen> but the error message for concat doesn't make sense if that is true
<codec1> ok, I would gladly take the solution for append
<SeanTAllen> right its a really bad error message
<codec1> and I don't get what you mean about the error message for append
<SeanTAllen> which i am going to ask you to open a bug report for
<codec1> :)
<SeanTAllen> here's what you need to make append work
<SeanTAllen> im on call
<SeanTAllen> need to disappear for a bit
<SeanTAllen> will look at concat in a bit
<codec1> ok thanks
<SeanTAllen> which means look at what iterator is doing
<SeanTAllen> if you change list from a val back to a ref
<SeanTAllen> you'll see the same basic error
<SeanTAllen> the problem isnt really with the receiver
<SeanTAllen> its the receiver being iso + the mutable parameter.
<SeanTAllen> @jemc the erorr message that @codec1 got is really bad. thoughts on a better error message?
<codec1> I don't understand how they both relate
<jemc> haven't been following along - got a link to the error message you're talking about?
<codec1> when the compiler is saying receiver type is not a subtype of target type, is it speaking about "bytes" or "bytes_list"?
<codec1> jemc, I think Sean talk about this one https://playground.ponylang.org/?gist=5af5e89c237bd26a1ee72f043ad1f136
<SeanTAllen> thats not the one
<SeanTAllen> that one has a good clue
<SeanTAllen> message here jemc:
<SeanTAllen> Array%5BU8%20val%5D%20end%0A%20%20%20%20bytes.concat(bytes_list.values())%20%2F%2F%20doesn%27t%20work%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20but%20this%20does%0A%20%20%20%20%2F%2Ffor%20a_byte%20in%20bytes_list.values()%20do%0A%20%20%20%20%2F%2F%20%20bytes.push(a_byte)%0A%20%20%20%20%2F%2Fend%0A%20%20%20%20%0A%20%20%20%20rb.append(consume%20bytes)
<SeanTAllen> https://playground.ponylang.org/?code=use%20%22collections%22%0Ause%20%22buffered%22%0A%0Aactor%20Main%0A%20%20new%20create(env%3A%20Env)%20%3D%3E%0A%20%20%20%20let%20bytes_list%20%3D%20List%5BU8%5D%0A%20%20%20%20%2F%2F%20filling%20that%20list...%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20later%20on%0A%20%20%20%20let%20rb%20%3D%20Reader%0A%20%20%20%20let%20bytes%20%3A%20Array%5BU8%20val%5D%20iso%20%3D%20recover%20iso%20
<SeanTAllen> o wait i didnt scroll down
<SeanTAllen> nevermind there is the "if everything was sendable" down at the bottom
<SeanTAllen> i thought that was missing
<jemc> yeah, the important part is "this would be possible if the arguments and return value were all sendable"
<SeanTAllen> i think the message could definitely be improved
<SeanTAllen> i missed that it was there
<SeanTAllen> and thought it was an awful message because that info was missing
<SeanTAllen> is there any way to get a sendable Iterator?
<codec1> in my case even after re-reading that I don't understand it either
<jemc> iterators have to be mutable because they need to change their "next"-related state
<jemc> theoretically you could have an iso iterator over a val collection
<SeanTAllen> yeah
<jemc> which you could arrive at using recover
<SeanTAllen> ill just say it again
<SeanTAllen> i hate iterators
<vaninwagen> i have to admit that i like them, because it is a good way to define some operations lazily on a collection without applying them immediately
<vaninwagen> together with itertools from stdlib they are quite fun
_andre has quit [Quit: leaving]
vaninwagen has quit [Ping timeout: 240 seconds]
dougmacdoug has quit [Quit: dougmacdoug]
mahmudov has joined #ponylang
jemc has quit [Ping timeout: 256 seconds]
jemc has joined #ponylang
gregrc has joined #ponylang
<gregrc> Hi, I was hoping someone might be able to give me some guidance on something. I'm used to functional programming where higher-order functions are common, and it's common to create and pass named functions into them or into a lambda. In Pony it seems I can't capture a method in a closure, and can only pass methods by partially applying them with no arguments. Is it just not idiomatic in Pony like it might be in Ruby?
<jemc> gregrc: welcome!
<jemc> we do indeed have lambdas/closures
<jemc> there are a couple pitfalls we are working to smooth over with them, but other than those, they work quite well for what you're talking about
<jemc> lambdas and partial application are both syntax sugar for object literals
<jemc> which is in turn syntax sugar for defining a new class, primitive, or actor with a so-called "hygienic" name that you don't have to see
<gregrc> Yeah, after reading through the tutorial I understand that it's making a new object was helpful. Again, I have to get used to primarily OO stuff.
<gregrc> So if I wanted to capture a method in a lambda, could I make a variable by partially applying the method, then close over that variable?
<gregrc> Ah, yeah trying that out works as I expect. Thank you. Now I just have to ruminate on capabilities some more to get where I feel comfortable with Pony
<SeanTAllen> gregrc: pop by anytime you have capabilities questions, if i'm around, i'll try and help. if i'm not, i'm always logged in and try to respond eventually. check the logs if you don't get an answer immediately.
<SeanTAllen> out of curiosity, what languages are you most familiar with?
<gregrc> Probably Elixir, Rust and Python. Which sort of explains my interest in Pony :)
<gregrc> The Rust gives me a little toe hold in capabilities, but it's different enough to still be kind of confusing.
<SeanTAllen> Well the basic ideas are there though.
<SeanTAllen> isolated data, immutable data, mutable data
<SeanTAllen> did you read the "learning reference capabilities" section on the website?
<gregrc> Yeah I'm working through it now. I skimmed it once, then looked through when I ran into an issue, but now I'm re-reading it more thoroughly
<gregrc> I ran into some confusion with recovering capabilities
<SeanTAllen> recover might be a bad word.
<SeanTAllen> ive often wondered if a different keyword would have been better
<SeanTAllen> like
<SeanTAllen> `safe ... end`
<SeanTAllen> or
<SeanTAllen> `sterile ... end`
<gregrc> I think I just don't fully understand the concept. I tried using it essentially where I would .clone() in Rust but I don't know that it translates
<SeanTAllen> so
<SeanTAllen> i will try to explain what helped me
<SeanTAllen> and maybe it will help you
<SeanTAllen> or maybe confuse you
<SeanTAllen> so...
<SeanTAllen> recover i think, is really about having a safe zone to do things with mutable things in a safe way
<SeanTAllen> you can reference any external mutable variables/data structures inside a recover block
<SeanTAllen> that means, you can create a mutable data structure inside of recover, mutate it
<SeanTAllen> then return a non-mutable or otherwise different capability version of it
<SeanTAllen> and the compiler can know its safe
<SeanTAllen> because nothing "unsafe" can escape
<SeanTAllen> this can be used in many different way
<SeanTAllen> for example, a really simple way
<SeanTAllen> by default, arrays are mutable, so what if i want to create an array with a few items and then have it be mutable...
<SeanTAllen> here's a silly example of that... but you can get the idea...
<SeanTAllen> but i could also use like this...
<SeanTAllen> String is normally a val, if i really wanted to, i could use a recover to make it an iso...
<SeanTAllen> sorry, i mean String is normally a ref
<SeanTAllen> Thinking about recover from that angle makes it easier for me to reason about
<gregrc> That makes sense
<gregrc> Thanks.
<SeanTAllen> you're welcome
<gregrc> Could I ask kind of a motivating question? I cannot figure out how to change an Iter[U8] back into a string.
<gregrc> But I run into this: Array[U8 val] iso! is not a subtype of Array[U8 val] iso
<SeanTAllen> do you have a bit that would compile were it not for the error?
<SeanTAllen> then i can see specifically what you ahve going on...
<SeanTAllen> but.. `Array[U8 val] iso!
<SeanTAllen> iso! is an alias to an iso
<SeanTAllen> so you need to consume the iso in question
<SeanTAllen> consume destroys an alias
<SeanTAllen> line 28
<SeanTAllen> String.from_iso_array(consume transcribed)
<SeanTAllen> from_array would work as well
<SeanTAllen> from_iso_array is really for when you have an isolated array and you want an isolated, mutable string back
khan has quit [Quit: khan]
<gregrc> Ah... Okay that makes sense.
khan has joined #ponylang
<gregrc> Yeah I definitely didn't understand either recover or consume the last time I worked on this. It makes much more sense now
<SeanTAllen> awesmome!
<SeanTAllen> errr
<SeanTAllen> awesome!
<SeanTAllen> long week
<SeanTAllen> typing bad apparently
<gregrc> So when the compiler says "this would be possible if the subcap were more ephemeral" it means, "you should consume that alias"?
khan has quit [Client Quit]
khan has joined #ponylang
<SeanTAllen> is that what the error message said?
<SeanTAllen> and yes
<SeanTAllen> that is what it meant
<gregrc> Yeah that's the second part of the iso! is not a subcap of iso error
<SeanTAllen> that's a pretty bad error message i think.
<SeanTAllen> i would never figure out from that given that it is pointing into Iter.pony