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
ashp has joined #ponylang
<ashp> Quick question, is there a "generally used" http server written in pony I can check out? Something similar to cowboy/elli in erlang?
<ashp> We tried to do something recently in elixir and the performance was pretty bad and I keep meaning to play with pony...
<doublec> ashp: there's an http server example but it's a toy example https://github.com/ponylang/ponyc/tree/master/examples/httpserver
<doublec> ashp: I don't know of any production quality http server
<ashp> a toy example will do for some tinkering around, thanks!
<jemc> ashp: the intent is that someone with the need and the skills will rewrite the `net/http` package to be less proof-of-concept and more serious and production-ready
<ashp> sadly I'm not a competent anything so that'll never be me, but it'll at least let me play around and get a feel for the language :)
<jemc> great, and feel free to ask in here when you hit snags
<jemc> (or on the mailing list for a more long-form conversation)
<doublec> ashp: I've used the http server in a project if you have any questions
aturley has joined #ponylang
aturley has quit [Ping timeout: 240 seconds]
gmcabrita has quit [Quit: Connection closed for inactivity]
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
SilverKey has joined #ponylang
SilverKey has quit [Client Quit]
SilverKey has joined #ponylang
copy` has quit [Quit: Connection closed for inactivity]
aturley has joined #ponylang
aturley has quit [Ping timeout: 244 seconds]
graaff has joined #ponylang
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ponylang
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ponylang
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ponylang
SilverKey has quit [Max SendQ exceeded]
SilverKey has joined #ponylang
SilverKey has quit [Client Quit]
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
rurban has joined #ponylang
amclain has quit [Quit: Leaving]
aturley has joined #ponylang
<doublec> If have two promises, p1 and p2, can I have a third promise run only when both p1 and p2 are fulfilled?
aturley has quit [Ping timeout: 265 seconds]
<doublec> I want to send off two async requests and do something with the results when both complete
trapped has joined #ponylang
<jemc> doublec: I don't think such a utility class currently exists in the promises package - you'd have to write it yourself
<jemc> effectively you'd want to create an actor called something like `PromiseJoin2[A1,A2]`
<jemc> and you'd need it to produce some glue objects as the fulfill or reject functions to pass to the source promises
trapped has quit [Read error: Connection reset by peer]
<jemc> one way to do this is to have some `fun tag`s on that actor that can produce the fullfill and reject functions
<jemc> they would contain the tag reference to the PromiseJoin2 actor, and could send it an appropriate message to mark fulfillment
<doublec> Thanks, that's I'm writing something similar to that but not generic. If I get it working I'll try and make it generic.
<jemc> yeah, I think it would probably be nice to have some generic utlity classes like that in the promises package
tm-exa has joined #ponylang
jemc has quit [Ping timeout: 260 seconds]
aturley has joined #ponylang
aturley has quit [Ping timeout: 252 seconds]
tm-exa has quit [Quit: Computer has gone to sleep]
Matthias247 has joined #ponylang
tm-exa has joined #ponylang
tm-exa is now known as tm-away
tm-away is now known as tm-exa
aturley has joined #ponylang
aturley has quit [Ping timeout: 260 seconds]
lispmeister has joined #ponylang
gmcabrita has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 246 seconds]
<ohir> remarks from the other side of concurency: https://bluishcoder.co.nz/2016/05/04/bang-hat-and-arrow-in-pony.html
rurban has left #ponylang [#ponylang]
aturley has joined #ponylang
aturley has quit [Ping timeout: 250 seconds]
trapped has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 265 seconds]
<doublec> Where would one use 'trn' over 'iso'?
<doublec> If I create a mutable string to append to and then convert to a val for later use both 'trn' and 'iso' work as the initial string
<doublec> I guess accessing fields on a trn object gives you a box in places vs the tag an iso gives you
_andre has joined #ponylang
<doublec> I'm implementing an interface that defines the function as being partial but my implementation is not partial
<doublec> the compiler gives an error that the body is not partial
<doublec> Can I get it to ignore that somehow?
<jonas-l> I think you can mark the function as not partial
<jonas-l> and it will still satisfies the interface
aturley has joined #ponylang
lispmeister has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<SeanTAllen> you can leave the partial off of the interface
<doublec> hmm, I must be doing something wrong
<SeanTAllen> thats specific to an implementation and isnt part of the type signature itself.
<doublec> this is the code with partial left off: http://pastebin.com/GqCZqxZM
aturley has quit [Ping timeout: 265 seconds]
<doublec> and the error I get
<doublec> Oh duh
<doublec> Copy paste error from other code. I'm returning a partial function hence the error.
<doublec> I have an RPC function that takes a Promise[String]. I want to call a function when that promise is fulfilled that takes a U32.
<doublec> This is what I have: http://pastebin.com/ntULAzPP
<doublec> Does that look right?
<doublec> That last p(42) should be p2(do_something())
<jonas-l> to me it looks weird..
<jonas-l> I think rpc.run() should return
<jonas-l> a promise
<doublec> rpc.run() can't return anything because it's a behaviour
<doublec> so it gets passed one
<doublec> let me modify it to make it clearer
<jonas-l> not sure why you need a Promise then..
<SeanTAllen> doublec: you can do fun tag run(): Promise[U32] on Rpc. Check out the Registrar actor in the Bureaucracy package. Not saying you should but you can approach it that way.
<jonas-l> I imagine you could just provide a callback to be executed on the result
<SeanTAllen> you can also use a Promise to do a callback. Its part of the pattern here: http://patterns.ponylang.org/testing/output-only-actors.html
<SeanTAllen> the nice thing about using a promise rather than a callback is that you can explicitly handle failure/rejection in a clean way. Its a nice way to represent that, whereas a callback isn't. At that point, it really depends on "can this fail".
<doublec> Right, that's why I'm trying to use a promise vs a callback
<doublec> So I have a behaviour do_something that puts the result in a Promise[String]
<doublec> I want to call that but get a U32 as the reslut
<doublec> so I create a Promise[U32] and and call .next on the Promise[String] and have it do the conversion and fulfill the Promise[U32]
<doublec> What I want to do is chain the promises
<SeanTAllen> Yes.
<SeanTAllen> I think the simplified example is obscuring what you are trying to do. It is at least for me. Whats the use case?
<doublec> I'm doing an HTTP request that returns JSON
<doublec> It does this by Fulfulling promise with the JSON
<doublec> I want a field of that JSON. So I though't I'd chain two promises - the one that gets the JSON, followed by one that extracts the field.
<doublec> I could chain in from the caller
<doublec> something like:http://pastebin.com/8xPAEgpt
<sylvanc> that looks good to me - what's the problem?
<SeanTAllen> ah, makes sense doublec
<sylvanc> it even compiles and runs :)
<doublec> This seems to do what I want: http://pastebin.com/NhzS4v3p
<doublec> sylvanc: I wanted to factor out the conversion to U32
<doublec> sylvanc: so callers didn't need to do it all the time
<doublec> I had to change to an object literal there because I couldn't do a "recover lambda ref(...) => ..." to iso
<sylvanc> ah, because the lambda has no captures, so it is generated as a primitive
<doublec> right
<sylvanc> interesting, seems like the compiler should allow that
<doublec> I'm wrapping the bitcoin RPC api. The I have a general function that returns the JSON from the different calls and specific wrappers that do the conversion by chaining the promises.
<doublec> I think that last paste looks like a good approach
<doublec> dealing with JsonDoc (or any tree structure) where you want to extract parts of the tree and send to another actor really teaches you about capabilties
<doublec> and shows me how easy it is to accidentally send data owned by something else if the typesystem didn't stop me
aturley has joined #ponylang
aturley has quit [Ping timeout: 244 seconds]
<doublec> Now I almost want some syntactic sugar that converts "be foo(.., Promise[A])" to be wrapped as "fun tag foo(...) let p=Promise[A]; foo(..., p); p"
<doublec> Oz worked something like that. A procedure called foo(A, B, C) called be called as C = foo(A, B)
TwoNotes has joined #ponylang
<TwoNotes> I am looking for a flow-control mechanism in TCPConnection and not finding it. I want to avoid overwhelming the _pending mechnism when sending long files.
<TwoNotes> This would be in support of "Chunked transfer" under HTTP
<TwoNotes> It looks like TCPConnection is aware of when the OS can accept more data to write, but this fact is not communicated back to the Notifier
<TwoNotes> Otherwise, if I was sending a 10MB MP3 file, I would end up sucking all 10MB into memory, stored in the _pending buffer. This seems wasteful
<TwoNotes> Should I file an Issue, or is there some way to do this I am missing?
copy` has joined #ponylang
aturley has joined #ponylang
Matthias247 has quit [Read error: Connection reset by peer]
aturley has quit [Ping timeout: 260 seconds]
<doublec> this is weird. I parse a json string. I then do a json.string() and print it, it's the same as what's parsed. I pass the json object to a behaviour and print it and it's corrupted.
<doublec> This is the output: http://pastebin.com/z3xktciN
jemc has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 240 seconds]
<doublec> I raised issue 801 for the json parsing problem
<jemc> sylvanc, doublec: that issue is part of the usability problems I've found with lambdas
<jemc> that is, the compiler should treat them sort of like it treats numeric literals, where it knows what the type *must be*, and it evaluates whether the given lambda *can be* that type
<jemc> this applies to both the cap of the lambda object and the cap of the apply method
<jemc> the interface for a lambda consists of both, and mismatches can make that interface unusable
<doublec> that would remove the 'end end' ugliness when having to use recover to make them iso too
<jemc> yes, totally, I hate that
<jemc> andymcn was saying this is just a special case of auto-recover, but that's not quite true
<jemc> as you've just found sometimes recover doesn't cut it
<jemc> because you can't recover a val to an iso, for example
<jemc> I reopened the ticket with this example, because it was closed in favor of the auto-recover ticket
<jemc> I think some extra compiler smarts for lambdas is still in order, even when we have auto-recover
<jemc> TwoNotes: should probably file an issue about it for discussion
SilverKey has joined #ponylang
<jemc> I also don't know of a way to do what you're asking, but it's an important concern from a backpressure perspective
<jemc> I know sylvanc has spent some time thinking about backpressure and he may have some ideas for this already
lispmeister has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 260 seconds]
amclain has joined #ponylang
<sylvanc> doublec: this is looking like a compiler bug, i'm working on it now
<sylvanc> thanks for the report and the test case!
<sylvanc> jemc: good call on reopening
<sylvanc> TwoNotes: yes, right now there isn't a backpressure mechanism in TCPConnection
<sylvanc> there's some runtime stuff that will happen for backpressure
<sylvanc> but i think also TCPNotify should probably get informed when writing is saturated
gsteed has joined #ponylang
<jemc> yeah, me too
<jemc> it's not clear to me how that would get communicated back to the actor calling write/writev though
<jemc> (well, nevermind, it's super clear - just with a message :P)
<jemc> but that wouldn't be standardizable though
graaff has quit [Quit: Leaving]
<jemc> that is, its specific to your custom notifier object and user actor
jemc has quit [Ping timeout: 252 seconds]
tm-exa has quit [Quit: Computer has gone to sleep]
<TwoNotes> I was thinking a 'drained' callback that would let the Notifier know that the _pending buffer has been emptied. My Notifiers usually have a reference to the parent actor by which I can tell it of such events.
<TwoNotes> A streaming server tpically fetches some chunksize from a big file (say 20KB) and send that, then would wait for this 'drained' event to send the next chunk.
<TwoNotes> Chunked transfer is used any time the payload has unknown size (such as rows fetched form a database) or is very big
<TwoNotes> I am porting some code from Erlang that uses the "cowboy" web server, and it has support for this mode.
rurban has joined #ponylang
aturley has joined #ponylang
_andre has quit [Quit: leaving]
ifraixedes has joined #ponylang
lispmeister has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
aturley has quit [Ping timeout: 260 seconds]
<ifraixedes> I would like to read some responses from people who is experience on Ponny in this mailing list thread https://groups.google.com/forum/#!topic/golang-nuts/HNamtQHPZlA
rurban has quit [Quit: Leaving.]
ifraixedes has quit []
<dom96> Cool to see Rob Pike replying.
SilverKey has quit [Quit: Halted.]
draynium has quit [Remote host closed the connection]
<TwoNotes> Thecomment "When you need a reference table to determine behaviours, the game is lost."
<TwoNotes> I think this can be taken as a criticism of the early documentation, rather of the basic principle.
SilverKey has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
<mcguire> I just submitted issue #802 on setting the terminal for stdin to raw mode. Feel free to ignore it or just close it, it's minor. But I found it confusing.
<mcguire> "Apparently, they threw a lot of "cool features" into the language without reasoning about orthogonalityand without caring to write the language specification.Also, they guarantee deadlock-freedom by using channels with unbounded buffers..."
SilverKey has quit [Quit: Halted.]
<mcguire> Ouch. On the other hand, that's one thing you can say about Go: no one threw a lot of features into it. :-) But that unbounded buffer thing is going to be a problem.
SilverKey has joined #ponylang
<mcguire> The discussion does reference (https://groups.google.com/d/msg/golang-nuts/HNamtQHPZlA/Oh9DHcS0AwAJ) one of my favorite blog posts: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ (Vitreous humour, indeed.)
SilverKey has quit [Quit: Halted.]
tm-exa has joined #ponylang
tm-exa has quit [Client Quit]
tm-exa has joined #ponylang
tm-exa is now known as tm-away
tm-away is now known as tm-exa
tm-exa is now known as tm-away
tm-away is now known as tm-exa
tm-exa has quit [Client Quit]
SilverKey has joined #ponylang
tm-exa has joined #ponylang
aturley has joined #ponylang
aturley has quit [Ping timeout: 250 seconds]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ponylang
<sylvanc> doublec: what a great bug discovery! fixed, will push it later tonight
<sylvanc> it was indeed a deep compiler bug - 1 line change to fix, fortunately
tm-exa has quit [Quit: Computer has gone to sleep]
Matthias247 has joined #ponylang
aturley has joined #ponylang
<TwoNotes> Filed issue #806 about backpressure support in TCPConnection
aturley has quit [Ping timeout: 244 seconds]
Matthias247 has quit [Read error: Connection reset by peer]
trapped has quit [Ping timeout: 260 seconds]
trapped has joined #ponylang
SilverKey has quit [Quit: Halted.]
aturley has joined #ponylang
aturley has quit [Ping timeout: 250 seconds]
TwoNotes has quit [Quit: Leaving.]
jemc has joined #ponylang
gsteed has quit [Quit: Leaving]
<doublec> sylvanc: thanks for the fix!
<sylvanc> thanks for the report :)
aturley has joined #ponylang
aturley has quit [Ping timeout: 276 seconds]
trapped has quit [Read error: Connection reset by peer]
gmcabrita has left #ponylang [#ponylang]
aturley has joined #ponylang
aturley has quit [Ping timeout: 252 seconds]