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
drakode has quit [Ping timeout: 252 seconds]
wobba has joined #ponylang
<wobba> Hello, is this the place to ask possibly stupid questions?
wobba has quit [Quit: Page closed]
jaro has quit [Ping timeout: 248 seconds]
dipin has quit [Quit: dipin]
endformationage has quit [Quit: WeeChat 1.9.1]
_whitelogger has joined #ponylang
<vaninwagen> wobba given there are no stupid questions, go straight ahead and ask. We'll do our best to answer
<vaninwagen> drakode thats a kinda broad question. You can do anything you need with Pony. But the most compelling use case for pony would be if you have a hard concurrency problem at hand. Or some networking code, think a game backend server or a webserver. Think of wallaroo, a stream processing engine, all those things that need high concurrency and low latency
<vaninwagen> There are probably a lot more use cases, i just named a few examples
<vaninwagen> If you gotta do something like this but do it safely
khan has joined #ponylang
_whitelogger has joined #ponylang
khan has quit [Remote host closed the connection]
khan has joined #ponylang
_whitelogger has joined #ponylang
khan has quit [Remote host closed the connection]
khan has joined #ponylang
jaro has joined #ponylang
user10032 has joined #ponylang
kempe has quit [Quit: WeeChat 1.8]
kempe has joined #ponylang
khan has quit [Quit: khan]
ExtraCrispy has joined #ponylang
dipin has joined #ponylang
dipin has quit [Client Quit]
endformationage has joined #ponylang
ExtraCrispy has quit [Ping timeout: 276 seconds]
_whitelogger has joined #ponylang
xllndr has joined #ponylang
user10032 has quit [Quit: Leaving]
ein_ has joined #ponylang
<ein_> hello~
<ein_> i have a question about the c-ffi
<ein_> specifically, one of the ffi-functions i want to wrap requires an array to be allocated, the pointer to it passed, and the function will populate the array with values
<ein_> now, the .cpointer() method on Array seems to return a tag
<ein_> so i'm wondering if that'd be a suitable way to pass the underlying memory-block to the c-function?
<ein_> i also looked at the FFI-example, and there the array is is just passed in as is, but that would pass the pointer to the struct of the array instead right?
<vaninwagen> Array.cpointer() is exactly the right way
<ein_> okay
<ein_> thank you (y)
<vaninwagen> The reference capability is erased at runtime
<vaninwagen> It just gives you another safety layer for accessing memory blocks in pony
<vaninwagen> You cant do much with such a pointer, because it might be unsafe to fiddle with it
<ein_> ye, i wasn't worrying that the C lib would have issues, just if it being a tag meant that it was bad form, or that pony maybe expects some things which would be invalidated
<vaninwagen> But if you cross the bordee to c ffi land, there be dragons anyway :)
<ein_> true
<ein_> thanks a bunch
<ein_> will come back and complain if computer catches fire tho
<ein_> xp
<vaninwagen> sure!
<ein_> actually i have another question:
<ein_> as said, i'm wrapping some C-stuff, and if i have a struct for which i don't need to have access to the fields
<ein_> can i declare the c-functions to return a primitive, associate functions with that primitive, and use "this" to pass the actual struct value along to the c-ffi calls?
<ein_> or would i need to wrap the primitive in a class?
<vaninwagen> I do not fully understand your approach but i think it wont work that way
<vaninwagen> A pony primitive cant have fields and such
<vaninwagen> And i dont know all the details how the pony runtime handles the memory for primitives, but you most likely run into issues
<vaninwagen> Id suggest stick to a Pointer or use a struct
<vaninwagen> Which you could both wrap with a class
<vaninwagen> Or are you talking about numeric primitives like U32 ?
<ein_> no, i have a c-struct which has some fields
<ein_> but i don't require access or knowledge about the fields
<ein_> i just thread them along to functions etc.
<ein_> i've just converted what i had wrapped to just be a primitive, and declared the c-stubs to return such a primitive
<ein_> and it seems to work fine
<ein_> header i mean
<ein_> for what it's worth, the tutorial also mentions to use primitives to represent struct-pointers
<ein_> i do wonder, tho, how it all behaves with garbage-collection etc.
xllndr has quit [Quit: Leaving]
ein_ has quit [Quit: Page closed]
aturley has joined #ponylang
aturley has quit [Client Quit]