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
bitcrusher has joined #ponylang
acarrico has quit [Ping timeout: 240 seconds]
bitcrusher has quit [Read error: Connection reset by peer]
gokr has quit [Ping timeout: 240 seconds]
nisanharamati has quit [Quit: Connection closed for inactivity]
acarrico has joined #ponylang
acarrico has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ponylang
bitcrusher has joined #ponylang
krylon has joined #ponylang
krylon has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
jemc has quit [Ping timeout: 248 seconds]
endformationage has quit [Quit: WeeChat 1.9.1]
ekr has quit [Ping timeout: 248 seconds]
ekr has joined #ponylang
ekr has quit [Changing host]
ekr has joined #ponylang
dipin has quit [Quit: dipin]
enilsen16 has joined #ponylang
gokr has joined #ponylang
bitcrusher has quit [Read error: Connection reset by peer]
TheMouster has joined #ponylang
<TheMouster> Hello!
<TheMouster> Just learning Pony. Started today. Seems nice. Can someone point me in the direction some doco that explains how to convert a string to a U8?
<doublec> TheMouster: there's an 'array' method on String.
<doublec> I'm trying to find where this is documented online
<doublec> TheMouster: see the method here https://stdlib.ponylang.org/builtin-String/
<doublec> TheMouster: search for "Returns an Array"
<TheMouster> I believe it will help more if I explain what I'm trying to accomplish. I'm feeding the app a number from the command-line. I need to read the input as a number. e.g. ./app 8
<TheMouster> Thanks for the input doublec
<doublec> TheMouster: there's a u8() method on String
<doublec> TheMouster: so get the argument as a String, call 'u8()' and you'll have it parsed a U8
<doublec> TheMouster: it's a partial function so it raises an error if it fails
<TheMouster> Ahh. Giving it a try now...
<TheMouster> Thankyou <doublec>
<TheMouster> Now to tackle the next bug :-)
<doublec> have fun :)
<TheMouster> Thanks. I am :-)
ekr has quit [Quit: leaving]
<SeanTAllen> welcome TheMouster. if you ever can't get an answer here and depart, there is a link to the logs in topic. we try to answer all questions even if the question leaves. there's also a mailing list in case you weren't aware. happy Ponying!
TheMouster_ has joined #ponylang
<TheMouster> Hi SeanTAllen. I had a look there. Is there a way to search all the logs, or must you do it day by day?
<TheMouster_> Ignore me. Found it.
<TheMouster_> Thanks
<TheMouster_> I thought that the search link referred to only the users listed below it. Not all the posts.
<TheMouster_> Sorry, channels not users. Doh!
TheMouster_ has quit [Client Quit]
<SeanTAllen> ive never tried to search so you now know more than me
<TheMouster> And you've learned at least one new thing for today. :-)
<SeanTAllen> i have indeed
gokr has quit [Ping timeout: 258 seconds]
enilsen16 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
krylon has joined #ponylang
TheMouster has quit [Quit: Page closed]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
<krylon> Excuse me for asking a silly question, but is there a Pony library to check if a given IPv4 address is in a given IPv4 network?
_whitelogger has joined #ponylang
bpicolo has joined #ponylang
<bpicolo> Is the only valid promise syntax using `recover`? Will a lambda work as the target?
bpicolo has quit [Ping timeout: 260 seconds]
bpicolo has joined #ponylang
<bpicolo> What might I be doing wrong here? https://gist.github.com/bpicolo/bda8ca90ba5dc584a1893b905cec8f02
<bpicolo> unclear why it's expecting an env
<bpicolo> wait a minute is my syntax all wrong
<bpicolo> ahh that should just be `test`
bpicolo has quit [Ping timeout: 260 seconds]
markmarkmark has joined #ponylang
endformationage has joined #ponylang
dipin has joined #ponylang
bpicolo has joined #ponylang
<bpicolo> If my executable is hanging after tests, what does that mean?
<bpicolo> actors still...acting? Would connections open be a problem?
<bpicolo> (TCPConnection)
<bpicolo> Hmmm, looks like as long as the TCPConnection is open they won't shut down
<bpicolo> so how do I close those out...
jemc has joined #ponylang
bpicolo has quit [Ping timeout: 260 seconds]
jemc has quit [Ping timeout: 240 seconds]
jemc has joined #ponylang
c3st7n has joined #ponylang
vaninwagen has joined #ponylang
<c3st7n> Hi all. Is it possible to access errno from pony? For example if I use @kill[I32](), and the return value is -1, how would I check the actual error number?
<SeanTAllen> krylon: not that i am aware of
<SeanTAllen> bpicolo: sending a dispose() message to a TCPConnection should shut them down. Or you can close from inside a notify method.
jemc has quit [Ping timeout: 240 seconds]
<krylon> Thanks. It's not that hard to write, but I thought maybe someone had already tackled this problem.
<SeanTAllen> c3st7n: take a look at how the File class does it. it uses an FFI call to @pony_os_errno[I32]()
<c3st7n> SeanTAllen: thanks, will take a look
<SeanTAllen> krylon: Outside of some basics in the standard library, Pony is very "batteries not included" right now.
<SeanTAllen> krylon: As more people join, it slows improves.
<SeanTAllen> c3st7n: you're welcome
<krylon> I noticed that. ;-)
<c3st7n> krylon: I wouldn't mind implementing it to get some pony practice, if you could specify the desired signature
<SeanTAllen> krylon: we wrote almost everything ourselves at Wallaroo Labs.
<krylon> c3st7n: Thanks, but I started another toy program already.
krylon has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
bitcrusher has joined #ponylang
jemc has joined #ponylang
dviola has joined #ponylang
c3st7n has quit [Quit: Page closed]
<dviola> hi
<jemc> dviola: hello!
vaninwagen has quit [Ping timeout: 248 seconds]
bitcrusher has quit [Read error: Connection reset by peer]
dipin has quit [Quit: dipin]
gokr has joined #ponylang
martinium has joined #ponylang
jemc has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
gokr has quit [Ping timeout: 258 seconds]
<martinium> I know Pony is good for concurrency problems but is the language parallel computing capable or do you have to fork processes to achieve parallelism?
gokr has joined #ponylang
<SeanTAllen> can you define parallel computing caprable martinium?
<SeanTAllen> i assume you mean, "capable of using more than 1 cpu at a time in a single process". if that is the question, the answer is yes. by default pony uses the number of cpus that you have available. you can control the number of scheduler threads (usually 1 per cpu) with the --ponythreads option
gokr has quit [Ping timeout: 240 seconds]
bpicolo has joined #ponylang
<bpicolo> Hi friends, having some trouble closing TCP connections in finalizers in the thing I'm hammering on
<bpicolo> Seems a `tag` var can't close the connection
<bpicolo> Can anybody point me in the right direction for a reshuffle?
<SeanTAllen> bpicolo: you want to send the "dispose" message
<SeanTAllen> and you can't send messages inside _final
<bpicolo> can't in a finalize?
<SeanTAllen> you want to implement your own dispose on _Connection
<bpicolo> how?
<SeanTAllen> that calls _conn.dispose
<SeanTAllen> implement a behavior called "dispose" on _Connection
<jemc> `be dispose() => _conn.dispose()`
<bpicolo> the issue is during app shutdown
<bpicolo> the app hangs because it wont gc
<bpicolo> Any way to avoid explicit dispose before closing
<bpicolo> ?
<jemc> the app hangs because it hasn't reached "quiescence" yet
<bpicolo> sure
<jemc> when you open a socket (or any other actor that can receive messages from "the outside world", Pony assumes that your program isn't finished until you `dispose` of that socket
<bpicolo> The question is how I can architect it so that the pool can just lie around until the app wants to tear down
<bpicolo> So explicit pool shutdown is the only possible way to end the program?
<bpicolo> Or is there some sort of...process monitor strategy or something?
<SeanTAllen> i dont understand your second question
<bpicolo> Which one?
<jemc> bpicolo: yeah, so in general, a Pony program ends when the runtime determines that it's not possible that it will receive any more messages - if you have a socket open, you can always receive more messages
<bpicolo> Right, I get that bit. But is there some sort of scoping I can make use of to make sure when Main finishes, I tear down?
<jemc> bpicolo: check out the `Custodian` actor here, it may be what you want: https://stdlib.ponylang.org/bureaucracy-Custodian/
<bpicolo> kk
<bpicolo> @jemc that seems like part of the puzzle, but Main ending wouldn't fire a signal yeah?
<jemc> it's definitely the pattern you want, but in many cases, I usually end up implementing the "custodian" pattern into my existing actor tree rather instead of relying on the stdlib `Custodian` type
<jemc> what do you mean by "fire a signal"?
<bpicolo> SigTerm means I've signalled the process in some way
<bpicolo> But when an app is done doing anything except holding open a connection, there's no obvious...err. signal?
<bpicolo> ahh
<jemc> in your application, how do you know when the application is "done" instead of just "idle"?
<bpicolo> @jemc I guess I could expect users to set up their own custodian
<bpicolo> @jemc sure, that's part of my question
<jemc> that's not meant to be a rhetorical question to prove a point - it's the real heart of this question I think
<bpicolo> In my case, I've left the scope of Main.create, which is (in other languages) the time I'd expect the app to end so to speak
<jemc> that's almost never the case in a real Pony program, though
<bpicolo> Gotcha
<SeanTAllen> Main exits once it is done setting up your program
<jemc> leaving the scope of Main.create usually means your program has *just begun* - nothing asynchronous has happened yet
<bpicolo> that's fair
<SeanTAllen> and the actors you created do their thing
<SeanTAllen> chug chug chug
<bpicolo> So there's typically no end other than an explicit signal?
<bpicolo> in practice
<SeanTAllen> that depends
<jemc> if you've got sockets or other "noisy" actors, then yes
<SeanTAllen> if your program waits for input then yes
<SeanTAllen> you need some kind of signal to shut down
<SeanTAllen> like a special message on your socket
<SeanTAllen> or a unix signal
<bpicolo> Okay. So perhaps the right strategy is to implement a dispose(), and then expect to use either a custodian or an explicit dispose call
<jemc> yeah, that's the best pattern for a library
<bpicolo> Thanks : )
<jemc> so in this case, you'd have `Pool.dispose()` that just disposes all the connections in the pool
<bpicolo> Right
<bpicolo> some of which are only tracked asynchronously for now buuuut I'll deal with that later
<bpicolo> seems somewhat surprising that reject() doesn't support an interface for a uhh
<bpicolo> rejection reason
<bpicolo> @jemc that worked, thanks :)
<bpicolo> https://github.com/bpicolo/pony-memcache/pull/1 So this is my first attempt at pony at all. Anybody open to giving me a bit of code review for some pointers / general guidance? :)
<jemc> I can try to give some thoughts
<bpicolo> Thanks!
<jemc> one general comment is that I see a lot of occurrences of `var` (in fields and as locals) where you never reassign it - in these cases `let` is more idiomatic - it's more restrictive and will help to better communicate the intent
<bpicolo> Sure, that's easy to remember
<jemc> when I'm reading Pony code and I see `var`, the first thing I do is look to see where it gets reassigned - using `let` makes it so I don't have to look around for that :)
<bpicolo> that seems maybe compiler-checkable but maybe that's more hassle than it's worth
<jemc> maybe I'm missing your point, but `let` is compiler-checked - the compiler will issue an error if you try to re-assign a `let`, but won't let you re-assign a `var`
<jemc> that's the reason why I, as a code reader, don't have to look for reassignments of a `let` - I know the compiler is preventing them, so it's one less thing for me as a reader to worry about when I'm trying to wrap my head around some code
<bpicolo> right
<bpicolo> I mean it could recommend `var` if it's not reassigned
<bpicolo> linter could do that too
<bpicolo> err
<bpicolo> recommend `let` for a non-reassigned var
<jemc> bpicolo: quick thought about simplifying things - is there a reason not to fold the logic from `Executor` into `_Connection`?
<jemc> seems like `Executor` is a bit of a superfluous actor
<bpicolo> I think that was my initial thought
<bpicolo> uhhh
<bpicolo> I think I thought at the time it was weird for the connection to track the promise, but it ended up needing it's own sort of callback
<bpicolo> Anyway
<bpicolo> for the release-into-pool
<jemc> can you chain the "release-into-pool" logic to the same `Promise[Result]`?