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
gmcabrita_ has joined #ponylang
gmcabrita has quit [Ping timeout: 240 seconds]
gmcabrita_ is now known as gmcabrita
<jemc> I'd have to see what line the remaining error si pointing to, but remember that you need to change occurrences of `File` to `File val`, including the match case
<jemc> or `File iso`, if you decide to use that
<FunkyBob> well, OpenFile returns File ref
<doublec> The recover makes it a val though
<doublec> it's probably the match clause needing to be changed to "File val"
<FunkyBob> match recover val OpenFile(full_path) end
<FunkyBob> | let src : File val =>
<FunkyBob> and I recover from val to ref?
<doublec> FunkyBob: no, leave it at val
<doublec> assuming File.read works on val
<doublec> ok, I guess it doesn't
<doublec> make it File iso then
<doublec> and recover iso, etc
<doublec> And put 'consume' in the relevant places
<doublec> Isn't Pony fun :)
<FunkyBob> ...
<FunkyBob> /home/curtis/src/bolted/main.pony:30:11: can't recover to this capability
<FunkyBob> ^
<FunkyBob> match recover iso OpenFile(full_path) end
<doublec> huh
<FunkyBob> and this is what I keep running into... rcaps hell
jemc has quit [Ping timeout: 258 seconds]
<SeanTAllen> FunkyBob: eventually it will become 2nd nature and you'll look back, wanting to teach people and have a hard time because you can't really remember what it was like
<FunkyBob> yeah, I'm sure
<FunkyBob> same thing happened in #django :)
<SeanTAllen> on the memory usage...
<FunkyBob> mmm?
<SeanTAllen> you can get some pretty high memory usage due to lack of backpressure
<SeanTAllen> based on internal hashes that are used for gc tracking and what not growing to really large sizes
<doublec> FunkyBob: it's because the result of OpenFile is actually a union type
<SeanTAllen> im still working on generalized backpressure to help control that
<doublec> FunkyBob: somethink like this works https://pastebin.com/jkpiiFfd
<doublec> FunkyBob: ie - you need to deconstruct the union type into the File ref, then return that as the iso
<doublec> s/return/recover
<FunkyBob> doublec: ok... was using the match to detect when openfile failed
<FunkyBob> as shown in th edocs
<doublec> Right, the docs don't use File as an iso which is why they do it that way
<doublec> In my example I'm casting it which raises an error if it fails and the try/end catches it. But that loses the reason for the error.
<doublec> In real code you'd OpenFile/handle the error in the recover block and then return the File from the recover block when you know it's a File probably
<doublec> Or some variant of that
<FunkyBob> ok, it builts now
<FunkyBob> builds
<FunkyBob> Transaction rate: 4653.81 trans/sec
<FunkyBob> still using gobs of memory
<FunkyBob> of course, since the sample file is so tiny, the twin behavior isn't really helping
<FunkyBob> blah, as soon as I switch to set_lentgh + send_chunk ... it doesn't work [seems to never terminate]
smoon has joined #ponylang
<FunkyBob> I would call finish() on the respnse, bu rcaps again :/
<FunkyBob> need to read up on ! and ^ gain, too
smoon has quit [Quit: smoon]
amclain has quit [Quit: Leaving]
smoon has joined #ponylang
chemist69 has quit [Ping timeout: 245 seconds]
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
smoon has quit [Quit: smoon]
<doublec> FunkyBob: try "(consume response).finish()"
plietar_ has joined #ponylang
<doublec> 'finish' is a val method which is basically saying that once it's called you can't modify the object
<doublec> Since we have an 'iso' alias to it in 'response' we can't have a val alias to it as well
<doublec> the 'consume' removes our iso reference to it.
chemist69 has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
<FunkyBob> hmm
<FunkyBob> but then I can't pass it to sesson, can I?
<doublec> FunkyBob: then do: let response: Payload val = consume response\nresponse.finish()
<doublec> Where are you calling finish? I don't think I have that update.
<FunkyBob> well, I thought I might need to call finish to indicate I'd finished passing data
<FunkyBob> as it currently doesn't seem to ever terminate the response
<FunkyBob> (that is, if I ever call response.set_length, which sets transfer mode other than OneShot)
<FunkyBob> so I was calling response.finish() just before _session(response) in sender
<doublec> That's fine, as above, consume the response, storing it in a 'Payload val'. Then pass that to the session.
<FunkyBob> I've tried understanding the http server code y/day... but it's a little beyond me for now
<FunkyBob> ah, ok
<doublec> (after calling finish)
<doublec> It'd be nice if 'finish' returned a Payload val.
<FunkyBob> that compiles
<doublec> Then you could do it in one line like you have
<FunkyBob> well, it compiles... but doesn't fix the problem :
<FunkyBob> :/
bbhoss has quit []
bbhoss has joined #ponylang
<FunkyBob> heh... just read "fun local_address()" and thought "Yeah, I want to find a fun local address!"
<doublec> haha
<FunkyBob> well, unless I find a timeout here somewhere, this is succeptible to slowloris...
<doublec> FunkyBob: I would not make the assumption that it's a production ready http server
<FunkyBob> doublec: certainly am not :)
<doublec> FunkyBob: it started off as an example, had contributions from a contributor to make streaming better but really hasn't been hammered.
<FunkyBob> am diving into the code now
<FunkyBob> as I await a new ticket from a cow-orker
k0nsl has quit [Quit: “If we don't believe in freedom of expression for people we despise, we don't believe in it at all — Noam Chomsky”]
k0nsl has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
<FunkyBob> ok... so, in streamed ot chunked, the server will call Handler.send_body
<FunkyBob> need_body , even
<FunkyBob> so, I've a plan, but it'll take much refactorying
<FunkyBob> -y
ericbmerritt_ has quit []
ericbmerritt_ has joined #ponylang
smoon has joined #ponylang
gmcabrita has quit [Quit: Connection closed for inactivity]
aav has quit [Ping timeout: 272 seconds]
aav has joined #ponylang
plietar_ has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
jemc has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 264 seconds]
jemc has quit [Ping timeout: 272 seconds]
papey_lap has joined #ponylang
adamkittelson has quit []
adamkittelson has joined #ponylang
smoon has quit [Quit: smoon]
plietar has joined #ponylang
plietar has quit [Ping timeout: 246 seconds]
malthe|away is now known as malthe
j14159 has quit []
j14159 has joined #ponylang
jeremyheiler has quit []
jeremyheiler has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
chemist69 has quit [Ping timeout: 272 seconds]
endformationage has quit [Quit: WeeChat 1.7]
chemist69 has joined #ponylang
fluttershy_ has joined #ponylang
papey_lap has quit [Ping timeout: 272 seconds]
papey_lap has joined #ponylang
abbiya has joined #ponylang
<fluttershy_> hello I have an FFI binding to a function in gsl library to generate a random vector of F64, but when I use the function inside a loop the vector doesn t exist anymore, but when used outside the loop it works perfectly fine. I want to use a loop to generate a random matrix at any size. What am I doing wrong here : https://gist.github.com/2be67f068d
<fluttershy_> 2d17296686fa748ea56321
<fluttershy_> oups I gave you the F32 binding here is the real FFI definition for F64 : https://gist.github.com/bacd61c5722aa665fcc3f9be1e8bb308
<fluttershy_> so line 53 is where I started having issue with rnd.ran_vector(nc)
IdkPony has joined #ponylang
<IdkPony> Does pony compile to an intermediate language? If yes, is it possible to access that intermediate code somehow?
<FunkyBob> only the LLVM IR, AFAIK
plietar has joined #ponylang
<FunkyBob> oh cool... there's a pony ackage for atom
plietar has quit [Ping timeout: 240 seconds]
<fluttershy_> my question was stupid, never mind I found the bug.
<FunkyBob> oh?
gmcabrita has joined #ponylang
k0nsl has quit [Quit: “If we don't believe in freedom of expression for people we despise, we don't believe in it at all — Noam Chomsky”]
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
k0nsl has joined #ponylang
k0nsl has quit [Client Quit]
k0nsl has joined #ponylang
k0nsl has joined #ponylang
k0nsl has quit [Changing host]
<FunkyBob> is it possible to use an actor in place as a class? can I just tweak the rcaps?
chemist69 has quit [Ping timeout: 240 seconds]
chemist69 has joined #ponylang
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
IdkPony has quit [Ping timeout: 260 seconds]
fluttershy_ has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
fluttershy_ has joined #ponylang
<fluttershy_> hello, I wants to generate a random matrix but looks like my code doesn't scale to big sizes, can someone please help me fix the problem with array allocations https://gist.github.com/6508751561d4b6a3671ec2775dad155c
<fluttershy_> memory usage reaches 2 to 3 Gb
<fluttershy_> I am not sure if it is because I used 2 dimensional array
<fluttershy_> should I make an array of arrays or array of pointers, what is the best option here ?
* doublec looks
<doublec> fluttershy_: it's about a 1GB array?
<doublec> fluttershy_: because there are no behaviours being called, no GC occurs. So memory overhead is higher.
<doublec> fluttershy_: try breaking things up into behaviour calls
<doublec> fluttershy_: so you get some GC
<fluttershy_> yes, well actually I want to make a pure serial implementation without using actors or behaviors first for the Cowichan set of problems and then do a parallel implementation.
<fluttershy_> so what I had in mind is just use pony arrays
<fluttershy_> is it possible that an array is always copied from FFI returned array ?
_andre has joined #ponylang
<doublec> fluttershy_: no GC occurs in your program from the start of main till the exit of it. It's like running with malloc and no free. I think that's the overhead.
<doublec> fluttershy_: but there could be internal copies - I'm not sure
<doublec> fluttershy_: hopefully someone else will know
<fluttershy_> doublec: ok I see thank you.
<doublec> fluttershy_: you can add behaviours without making it parallel
<doublec> fluttershy_: just turn one of your loops into a recursive behaviour call
<doublec> fluttershy_: it's still serialized since it's a single actor
plietar has joined #ponylang
chemist69 has quit [Ping timeout: 240 seconds]
obadz has quit [Ping timeout: 240 seconds]
plietar has quit [Ping timeout: 264 seconds]
chemist69 has joined #ponylang
wintermoo has joined #ponylang
obadz has joined #ponylang
<K4rolis> hi guys, any way someone has a statically linked ponyc for Linux x86-64? Reason for that is I have to work on a machine I do not have root access to and the LLVM installed in it by default is the unsupported 3.8, so if I want to build ponyc locally in an actual supported way I also need to build LLVM
<K4rolis> no docker either FYI
wintermoo has quit [Remote host closed the connection]
abbiya has quit [Remote host closed the connection]
plietar has joined #ponylang
<fluttershy_> doublec: ok, will try that thanks.
<SeanTAllen> K4rolis: not at this time, although there has been some movement towards working on that. We'd welcome help.
<SeanTAllen> K4rolis: you can use LLVM 3.8 but there are some bugs in it that you might hit.
<SeanTAllen> fluttershy_: at the moment, the check to run GC happens after each message to an actor is handled. so, as doublec says, by having everything in a single behavior, gc won't run. this can be very nice and predictable in a "normal" pony application but its not so good when people start playing around with an idea in Pony and put everything into the Main actor's
<SeanTAllen> create method as GC never gets called. There's work going on to do GC during behaviors that would solve that problem. I've advocated for that to be optional as there are really nice aspects to GC only runing after a behavior. Its much easier to reason about your performance in those scenarios.
<SeanTAllen> FunkyBob: re: "is it possible to use an actor in place as a class? can I just tweak the rcaps?" the short answer is "not really". You interact with an actor via behavior calls which are async. That fundamentally changes the semantics of what you are doing from when you call a synchronous method on class.
<fluttershy_> SeanTAllen: ok thank you.
wintermoo has joined #ponylang
jemc has joined #ponylang
<K4rolis> SeanTAllen: thank you, if I come up with something I'll get in touch - however, at this point I'm just going to build the 3.9.1 LLVM to be sure and link the ponyc to that. But I am interested in that sort of thing, so might actually do something about it at some point :
<K4rolis> :)
jemc has quit [Quit: WeeChat 1.4]
jemc has joined #ponylang
fluttershy_ has quit [Quit: Page closed]
chemist69 has quit [Ping timeout: 240 seconds]
wintermoo has quit [Remote host closed the connection]
chemist69 has joined #ponylang
wintermoo has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
<jemc> K4rolis: I don't think you should need root access to use a different LLVM
<jemc> you can download the LLVM binaries tarball from their official site, extract the tarball somewhere in your "home" directory (or anywhere you can put files without root access), add the `bin` dir from that tree to your `PATH`, and set `LLVM_CONFIG=llvm-config39` when building `ponyc`
<jemc> this is how I develop locally, because it gives me a lot of freedom to pick the LLVM version I want to use (I have many of them "installed" (extracted) at dirs within my home dir)
<jemc> if you need help with any of those steps, let me know
plietar has joined #ponylang
wintermoo has quit [Remote host closed the connection]
<K4rolis> jemc: I did a silly thing and built the LLVM myself - did not realise they distribute pre-compiled binaries. Thank you, will definitely keep this in mind!
<jemc> K4rolis: yeah, check out the "Pre-Build Binaries" sections at http://releases.llvm.org/download.html
<jemc> the links say "Clang for [Platform]", but it's really Clang *and* LLVM binaries
<K4rolis> jemc: and that was exactly what confused me :)
amclain has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
obadz has quit [Ping timeout: 240 seconds]
obadz has joined #ponylang
plietar has joined #ponylang
chemist69 has quit [Ping timeout: 272 seconds]
fluttershy_ has joined #ponylang
<fluttershy_> hi, how to get the index of the element in a for loop or I have to create a variable myself?
<jemc> fluttershy_: what are you iterating over?
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
<fluttershy_> jemc: an array
<jemc> use `Array.pairs()` instead of `Array.values()`
<fluttershy_> ah great thank you
<jemc> `for (idx, value) in my_array.pairs() do ... end
<fluttershy_> thanks made my life easier :)
plietar has quit [Ping timeout: 240 seconds]
chemist69 has joined #ponylang
plietar has joined #ponylang
<SeanTAllen> i always forget pairs exists
endformationage has joined #ponylang
fluttershy_ has quit [Quit: Page closed]
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 240 seconds]
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar has quit [Ping timeout: 258 seconds]
graaff has joined #ponylang
plietar has joined #ponylang
Candle has quit [Ping timeout: 264 seconds]
Candle has joined #ponylang
plietar has quit [Remote host closed the connection]
plietar has joined #ponylang
plietar_ has joined #ponylang
plietar has quit [Ping timeout: 255 seconds]
plietar_ has quit [Ping timeout: 255 seconds]
Matthias247 has joined #ponylang
TheLemonMan has joined #ponylang
graaff has quit [Quit: Leaving]
amclain has quit [Quit: Leaving]
amclain has joined #ponylang
wintermoo has joined #ponylang
_andre has quit [Quit: leaving]
Matthias247 has quit [Read error: Connection reset by peer]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
chemist69 has quit [Ping timeout: 240 seconds]
wintermoo has quit [Remote host closed the connection]
chemist69 has joined #ponylang
flutter95 has joined #ponylang
<FunkyBob> SeanTAllen: yeah, I came to realise I couldn't replace class with actor... because of defaulting ti tag, and other issues
<FunkyBob> so now I'm working on how can I pass a class attribute to someone
<doublec> FunkyBob: 'response' is a ref, you can't then make it a 'val' since you could be storing that ref in other places which would allow write access to the val
<FunkyBob> right
<doublec> FunkyBob: what you need to do is put the creation of the ref inside a recover block
* doublec writes an example
<FunkyBob> thanks
<FunkyBob> I did try playing with recover... but it hasn't quite gelled yet
<doublec> FunkyBob: https://pastebin.com/iCSfqWut
plietar has joined #ponylang
<doublec> (untested, etc)
<doublec> But the basic idea is you create it inside the recover, do the modifying things, then return it as a val
<doublec> This is safe because recover blocks are special - anything created inside it won't escape it - so the compiler knows that the ref is not shared
<doublec> btw that should be response'.set_length
<doublec> And returning response'
<doublec> I'm not sure this approach is right though
<FunkyBob> that much I've got about recover... it's sort of a lock block
<doublec> Because once the response is a 'val' it can't be modified
<doublec> And it seems to just set the length - where's the response body? or is that done some other way in the http server.
<doublec> Ah I see
<doublec> Note that you do: _response = response
<doublec> This won't work if response is a val since _response is a ref
<doublec> Once you convert it to a val you can't have any ref pointers hanging around
<doublec> Since a val promises that it will never change
<FunkyBob> woo
<FunkyBob> got somewhere
<FunkyBob> now it's complaining about an uncaught excp
<FunkyBob> even better:
<FunkyBob> /home/curtis/src/bolted/main.pony:50:7: try expression never results in an error
<doublec> FunkyBob: I notice you call _session(response). In the payload docs it says to set the session field of the payload.
<FunkyBob> it still doesn't work...
<FunkyBob> but... it compiles
<FunkyBob> it does?
<doublec> yes
<doublec> so: response.session = _session
<doublec> then you don't need to make payload a val
<FunkyBob> because?
<doublec> because the only reason you're making it a val is because the apply method of session requires a val
<doublec> But you don't call that
<doublec> You set the session to the session field of the payload
<FunkyBob> hmm
<doublec> and the underlying framework calls the apply method when 'finish' has been done
<doublec> (from what I can tell, reading the docs)
<FunkyBob> Submit the message for transmission by calling the either the HTTPSession.apply method (in servers) or the HTTPCLient.apply method in clients.
<doublec> Where is that?
<FunkyBob> under Sequence, step 5
<doublec> Oh right
<doublec> FunkyBob: note step 2 though
<FunkyBob> yes, am trying to correct that now
<FunkyBob> /home/curtis/src/bolted/main.pony:46:23: not safe to write right side to left side
<doublec> Ah I see
<doublec> send_chunk is a box method
<FunkyBob> /home/curtis/src/bolted/main.pony:34:18: right side type: HTTPSession tag
<doublec> So can be called on a val
<doublec> So your _response field should be a Payload val
<FunkyBob> var _response : Payload val
<FunkyBob> I'm dealing with session right now
<doublec> FunkyBob: something like https://pastebin.com/aTTTEuuE
<FunkyBob> I realised I don't need to hold onto session, it's only used in the constructor
<FunkyBob> /home/curtis/src/bolted/main.pony:44:15: can't access field of non-sendable object inside of a recover expression
<FunkyBob> says this of the "response.session = session"
<FunkyBob> /home/curtis/src/bolted/main.pony:44:24: this would be possible if the field wasn't assigned to
<doublec> Is 'response' declared inside the recover expression?
<doublec> Can you paste the recover block?
<FunkyBob> I think some of this may be coming from upstream rcaps on session, too
<doublec> FunkyBob: https://pastebin.com/MkSU7EmQ
<doublec> No need for recover now that we're not doing _session stuff, etc
* doublec actually tested that this time
<FunkyBob> ooh, tested code? I feel special :)
<doublec> tested as in "it compiles" :)
<FunkyBob> indeed it does!