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
jemc has quit [Ping timeout: 240 seconds]
jemc has joined #ponylang
jemc has quit [Ping timeout: 246 seconds]
chemist69 has quit [Ping timeout: 260 seconds]
unbalancedparen has joined #ponylang
chemist69 has joined #ponylang
jemc has joined #ponylang
aav has joined #ponylang
aav_ has quit [Ping timeout: 240 seconds]
unbalancedparen has quit [Quit: WeeChat 1.7]
gmcabrita has quit [Quit: Connection closed for inactivity]
jemc has quit [Quit: WeeChat 1.4]
jemc has joined #ponylang
amclain has quit [Quit: Leaving]
aav_ has joined #ponylang
aav has quit [Ping timeout: 264 seconds]
troxid has joined #ponylang
magicbit has quit [Ping timeout: 240 seconds]
magicbit has joined #ponylang
troxid has quit [Quit: Page closed]
jemc has quit [Ping timeout: 260 seconds]
jmiven has quit [Read error: Connection reset by peer]
jmiven has joined #ponylang
Praetonus has joined #ponylang
rosstuck has joined #ponylang
rosstuck has quit [Remote host closed the connection]
gmcabrita has joined #ponylang
K4rolis has joined #ponylang
<K4rolis> hi pony experts! I've got question on something that I suspect is quite a common pattern, but I just don't know how to elegantly do it. Let's say I've got a ref field in an actor which is an array of some objects with val capabilities. Let's now say that I want to take that field, make a val copy of it and send it to other actors. How do I do it?
<K4rolis> the initial idea is to do something sendable_field = recover val non_sendable_field.clone() end , but obviously that does not work given that non_sendable_field is, in fact, non sendable :)
<Praetonus> K4rolis: You can first create a new iso or trn Array and then append the elements to it manually
<Praetonus> Note that line 5 it should be possible to do `recover trn Array[U8](_array.size()) end` (the method is safe to call inside of the recover expression since the result is sendable) but apparently there is a compiler bug here and it isn't allowed. I'll look into it
<K4rolis> thank you, this makes sense. I've experimented with something like this before and got it to work, just wondered whether I could accomplish this with clone()
<K4rolis> I'm sure to have more questions to do with how to implement things "the pony way", because at the moment I feel that I'm fighting against capabilities rather than using them appropriately :)
<Praetonus> Yeah, it takes some time before getting the hang of it. Feel free to ask your questions here or on the mailing list
<K4rolis> just out of curiosity - does consume actually result in any instructions after the code has been compiled or is it purely for compile-time checks?
<SeanTAllen> compile time
<SeanTAllen> K4rolis: i'm curious. what's your particular use case for having the mutable field that you hold on to the data of but send immutable copies of to other actors. Not saying this is unusual, but I'm always interested in hearing specific use cases that might lead to a good pony pattern to write up.
xyproto has joined #ponylang
<xyproto> when using a C library from pony, like SDL2, how do I use a constant from C, like SDL_WINDOWPOS_UNDEFINED? use? let? primitive?
<xyproto> I could not spot anything about this in the documentation.
<K4rolis> SeanTAllen: it's a simulation - the mutable field lives in controller actor and effectively holds history of past states (it is used as a shift register) and those past states are required for the calculation of new states by the actors
<K4rolis> the execution of the simulation is effectivelly a fork-join thingy where a controller sends out a task and sits there waiting for all the workers to return their results
<SeanTAllen> xyproto: C constants don't really exist so you would need to recreate that constant in Pony. You can see an example of this in the ProcessMonitor where we use primitives to give names to various return codes. https://github.com/ponylang/ponyc/blob/master/packages/process/process_monitor.pony#L98
<SeanTAllen> K4rolis: thanks
<SeanTAllen> xyproto: when i say "don't really exist" for constants, i mean there is nothing exported from c code that pony could access as constants are generally text replacements done by the c preprocessor.
<xyproto> SeanTAllen: I see, thanks! Will just create my own constants in the pony code, then.
<xyproto> How do I pass a NULL to a C function when calling a C function from pony?
<SeanTAllen> use None
<SeanTAllen> not "use None"
<SeanTAllen> but
<SeanTAllen> None
<SeanTAllen> words, sometimes, they are difficult
<xyproto> :)
<xyproto> thanks, will try that
<SeanTAllen> is this a pointer?
<xyproto> yes
<xyproto> it expects a Pointer[_SDLRect], but I want to send in NULL
<SeanTAllen> is _SDLRect a struct in Pony?
<SeanTAllen> if yes, you should also check out MaybePointer and see if that is more appropriate
<xyproto> yes, it's defined with "struct _SDLRect\n var x: I32 = 0" etc
<SeanTAllen> check out MaybePointer
<xyproto> will check out MaybePointer, thanks!
<SeanTAllen> all FFI advice from me should be taken with a grain of salt as my experience is limited to certain key areas. its probably right but... possibly wrong
<xyproto> no worries, I am completely new to Pony and solidly in trial-error-read-documentation-ask-on-irc-land.
<xyproto> MaybePointer[None] is not allowed, and MaybePointer[_SDLRect](None) says thaat argument is not a subtype of parameter. MaybePointer[_SDLRect](0) results in "could not infer literal type". A bit stuck.
<xyproto> does the "tag" keyword make any difference?
<xyproto> I'm trying to make a Pony version of the collection of SDL2 samples at https://github.com/xyproto/hello_sdl2
<xyproto> just Pointer[_SDLRect] did the trick. According to the source in pointer.pony, Pointer structs are null pointers when created: https://github.com/ponylang/ponyc/blob/master/packages/builtin/pointer.pony
<SeanTAllen> check out MaybePointer[_SDLRect].none()
<xyproto> SeanTAllen: it works now, if you're interested. Thanks for the help! https://github.com/xyproto/hello_sdl2/blob/master/pony/main.pony
<xyproto> Ended up using just Pointer[_SDLRect] for the NULL.
unbalancedparen has joined #ponylang
jemc has joined #ponylang
Praetonus has quit [Quit: Leaving]
jemc has quit [Quit: WeeChat 1.4]
jemc has joined #ponylang
<SeanTAllen> awesome
amclain has joined #ponylang
staticassert has joined #ponylang
obadz has quit [Ping timeout: 268 seconds]
unbalancedparen has quit [Ping timeout: 240 seconds]
obadz has joined #ponylang
<Bombe> Huh, is there no XML library for Pony?
* Bombe needs an XML parser.
Xyliton has joined #ponylang
<jemc> Bombe: I'm not aware of one existing yet, unfortunately
<Bombe> That’s unfortunate.
<SeanTAllen> I assume at some point, some one will wrap libxml which is what a large majority of languages seem to end up doing as a first step
<Xyliton> Is is possible to get syntax highlighting in vim?
<Xyliton> *it
<jemc> Xyliton: I don't use vim, but it looks like some people are using this: https://github.com/dleonard0/pony-vim-syntax
<Xyliton> oh, thanks!
Xyliton has quit [Ping timeout: 240 seconds]
Matthias247 has joined #ponylang
Xyliton_ has joined #ponylang
Xyliton has joined #ponylang
<Xyliton> (according to the IRC logs my messages never arrived here so I'll just resend them. I hope that it's actually my client that messed up and I'm not sending these messages the n-th time to you now)
<Xyliton> I'm still trying to get my timed websocket message(s) working. Someone (sorry, forgot who it was) told me to use an actor which "manages" both the timer and the websocket notify, but I can't seem to implement that the way it was meant to be
<Xyliton> I messed everything up now, and this whole actor-model is confusing me a lot (+ all these capabilities ;-;)
<jemc> Xyliton: I think it was me you spoke with about this before - and don't worry, your client was disconnected, we didn't see your messages from before
<jemc> can you describe your difficulties?
<Xyliton> okay, so... After connecting to the server I want to interact with I'm forced to send heartbeat intervals in a regular interval. These heartbeat messages have to contain a payload I get with every message the server sends me (I always have to send the newest one)
<Xyliton> s/intervals/messages/
<Xyliton> But I'm not entirely sure where I should save said payload or the interval so I can create a timer which sends messages. This timer needs access to bot the tcp connection and the payload
<xyproto> åpn
<xyproto> sorry, dropped the phone on my face and it typed something
<Xyliton> loll
<xyproto> jemc: yes, I based it on that example, it was very useful
<jemc> Xyliton: just got on a call, sorry, will get back to this in about an hour
bweez_ has quit [Ping timeout: 245 seconds]
bweez_ has joined #ponylang
Xyliton has quit [Ping timeout: 240 seconds]
Xyliton_ has quit [Ping timeout: 258 seconds]
<jemc> Xyliton: my advicce to you would be to try to move as much logic as possible from `_DiscordWSNotify` into `DiscordActor`
<jemc> with the notify class only being used to forward calls to the actor ("glue code")
<jemc> that should set you up for success, I think
aav_ has quit [Ping timeout: 240 seconds]
hakvroot has quit [Ping timeout: 268 seconds]
hakvroot has joined #ponylang
<staticassert> ahhhhh i missed the sync call i am creating a meeting for it on my calendar right now
staticassert has quit [Quit: Page closed]
<SeanTAllen> Good idea
<SeanTAllen> Also bug bug TWIP to pony user list staticassert
_andre has quit [Quit: leaving]
mitchellvanw has quit [Ping timeout: 264 seconds]
mitchellvanw has joined #ponylang
waratuman has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]