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
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
jemc has quit [Ping timeout: 260 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 260 seconds]
jtfmumm___ has joined #ponylang
mrallen1_ has joined #ponylang
mrallen1 has quit [*.net *.split]
jtfmumm__ has quit [*.net *.split]
jtfmumm___ is now known as jtfmumm__
mrallen1_ is now known as mrallen1
plietar has joined #ponylang
jemc has joined #ponylang
jemc has quit [Client Quit]
jemc has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
aceluck has joined #ponylang
aceluck has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
jemc has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
amclain has quit [Quit: Leaving]
vaninwagen has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
papey_la1 has joined #ponylang
papey_la1 is now known as papey
papey_lap has quit [Ping timeout: 248 seconds]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
aceluck has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
_andre has joined #ponylang
vaninwagen has quit [Ping timeout: 248 seconds]
Praetonus has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
jemc has quit [Quit: WeeChat 1.4]
jemc has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
aceluck has quit [Quit: Textual IRC Client: www.textualapp.com]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
EngineerSam has joined #ponylang
<EngineerSam> Good morning.
papey_lap has joined #ponylang
papey has quit [Ping timeout: 240 seconds]
<SeanTAllen> good morning EngineerSam
<EngineerSam> Greetings.
<EngineerSam> I am mostly wandering in because I am curious if I could be pointed to an archive or record to explain the decisions made in the language design for having divide by zero return zero. I would have thought that the numbers would have been defined as, say, 'I32' be defined as '( I32_Raw | NaN )' where "Nan" would be a primitive. In which case dividing by zero could just return NaN. Since that was not chosen as a solution, I am
<EngineerSam> Not mentioned in the language FAQ or tutorial that I could see.
<Praetonus> EngineerSam: This is mostly to avoid an expensive `match` operation on the user side. Another option would be to raise an error on div by zero but that's expensive too
<SeanTAllen> the decision was made because if you return NaN or error (in the beginning it was error), it made writing all math related code very painful. there are possible performance implications but in the end all math operations where getting wrapped in error clauses which was found to be suboptimal. no one was happy with the decision at the time but it was decided it was "the least worst" option.
<SeanTAllen> there's nothing recorded for that, it is handed to us through spoken lore
<EngineerSam> Okay, thanks. I was just curious. I figured that instead of wrapping the all the math ops in checks it would be any operation with NaN would just return NaN and it would have been up to the user to check for it -- if they wanted to. Okay.
<jemc> EngineerSam: if we had a `NaN` primitive, and the return type for mathematical operations was `(<some machine word> | NaN)`, and you need to be able to `match` on the result later, then even if you're not doing the match until the end you're still paying the performance cost of "boxing the primitive"
<EngineerSam> Okay. Just didn't know the performance cost was that high.
<jemc> that is, wrapping the machine word (which may be as small as a single byte, in the `I8` or `U8` case) in a runtime object, with a type descriptor and the other overhead that all entails
<jemc> in a related topic, we recently added a set of "unsafe" math operators that return undefined values for some set of inputs, but are as performant as possible
amclain has joined #ponylang
<EngineerSam> Anyways, thanks everyone for the explanation. Time to get back to work.
EngineerSam has left #ponylang [#ponylang]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
endformationage has joined #ponylang
deep-book-gk_ has joined #ponylang
deep-book-gk_ has left #ponylang [#ponylang]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
<tokenrove> it's interesting to note that division by zero on RISC-V also does not trap, but returns all bits set (and remainder by zero equals the dividend).
Fuuzetsu has left #ponylang ["ERC (IRC client for Emacs 25.2.1)"]
Matthias247 has joined #ponylang
plietar has joined #ponylang
vaninwagen has joined #ponylang
plietar has quit [Ping timeout: 248 seconds]
kulibali has joined #ponylang
vaninwagen has quit [Ping timeout: 240 seconds]
vaninwagen has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
papey_lap has quit [Ping timeout: 260 seconds]
endformationage has quit [Quit: WeeChat 1.7]
aceluck has joined #ponylang
<aceluck> Quick question (hopefully): How do I keep my pony program from exiting? I do an ffi call that spawns a thread, and I need to wait for a callback before exiting
<aceluck> Loos like the ffi call I'm making needs to be called on the main thread, or it crashes with an assertion failure. It's being called in the main actor, but that doesn't seem to help?
<jemc> aceluck: Pony isn't going to play well with FFI libraries that try to contact pony from another thread the pony doesn't control
plietar has joined #ponylang
<aceluck> I'm trying to wrap libui, a gui library. I'm on a mac, and cocoa only allows gui functions to be called on the main thread
<jemc> I don't have much time to help you troubleshoot at the moment, but can give some general guidance
<Praetonus> aceluck: You can try building your program as a library to retain control of the main thread and the runtime termination
<jemc> I think your best bet for a clean solution is if the callback function will pass you some opaque object that you specify, as callback functions often do
<jemc> then you can use a "bare lambda" (in Pony terms) as the callback function, have the opaque object pointer be a Pony actor, and use the bare function as glue code to trigger a method call on your Pony actor
<aceluck> That makes sense
<Praetonus> jemc: I'm not sure that'll prevent the runtime from reaching quiescence
<jemc> that doesn't help (directly) with your issue of keeping the Pony application open, but I think your best bet for that would be to employ the `Timers` API to have an open recurring timer to keep your program alive, which you can cancel when you want the program to finish
<jemc> Praetonus: right, that's why I added the above note
plietar has quit [Ping timeout: 248 seconds]
<aceluck> I'm not yet as far as the actual callback though - just calling out to the ffi to open a window, causes it to crash with an assertion failure from cocoa, saying it needs to be called on the main thread.
<aceluck> Timers should solve the quitting issue, thanks
<aceluck> I tried running with --ponythreads=1 , but it doesn't seem to help
<Praetonus> aceluck: The main thread in a classic Pony program is used to start the runtime and then blocks until the runtime has exited
<Praetonus> You need to build as a library (with the `--library` flag on the compiler) and use C-API actors to communicate with the Pony part of the application
<Praetonus> This isn't well documented but I think we have an example somewhere. I'll try to find it
<aceluck> Praetonus: Okay, can do that I suppose. There's no way to usurp the main thread from within pony?
<Praetonus> No, you can't do that
<jemc> other than Praetonus' suggestion, I think your only other course of action would be to find out more about the "only invoked from the main thread" requirement, try to see if an alternate API is provided or if there is a way to bypass that limitation under controlled circumstances
<Praetonus> It would be an interesting feature, though
<Praetonus> Hm, I can't find that example
<aceluck> It would be useful to be able to build gui apps. Having to build it in c, then link pony in is a bit cumbersome.
<jemc> it definitely seems like it's going to be difficult to integrate that "run loop management" API with pony, as it's filling much the same role in the application as the pony runtime does
<aceluck> jemc: Not directly. I'm trying to make an ffi wrapper around libui, which is cross platform.
<aceluck> But it calls cocoa under the hood on macos
<Praetonus> aceluck: So basically, you can annotate an actor as a C-API actor by prefixing its name with the universal FFI symbol `@`. Then, when you invoke the compiler with the `--library` flag, it will build your package as a library and will generate a C header containing bindings to your C-API actors
<aceluck> Praetonus: All right, thanks. I'll try that. However, my goal was to make some gui support for pony, and this is a showstopper really
<Praetonus> That feature hasn't had much focus put into it so it's still very rough. As a rule of thumb to avoid usability problems, your C-API behaviours should only take and return types that have direct equivalents in C
<Praetonus> i.e. numeric primitives and Pointers
<aceluck> Okay
<Praetonus> Also I'd recommend you to look at what's available in the `pony.h` header. It contains the public runtime API, with things like memory allocation and GC tracing
<jemc> aceluck: can you point me to the docs for the function you're invoking that has the "main thread" requirement?
<jemc> it really feels like it should be exposing some kind of API that doesn't have that requirement, for applications that don't want the library to manage their event loop
<aceluck> jemc: It looks like there are discussions around this on their github. Let me dig a it deeper... maybe there is a way around
vaninwagen has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
Matthias247 has quit [Read error: Connection reset by peer]
obadz has quit [Ping timeout: 240 seconds]
<jmiven> doublec: hi! In your Bang, Hat and Arrow post, you wrote "If A is a String iso then A! would be a String trn" but if I understand correctly it should be String tag
obadz has joined #ponylang