The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2014-04-26

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:03 punter joined #mojo
00:15 genio sri: mojolico.us ok? I'm unable to reach it at the moment
00:24 sri genio: http://www.downforeveryoneorjustme.com/mojolicio.us
00:25 * sri wonders if the routing process would be more transparent if the documentation hinted at what the underlying regular expressions look like
00:26 good_news_everyon joined #mojo
00:26 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/DOVNIA
00:26 good_news_everyon mojo/master 30850e6 Sebastian Riedel: show more regular expressions in routing guide
00:26 good_news_everyon left #mojo
00:26 asarch joined #mojo
00:42 good_news_everyon joined #mojo
00:42 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/LIlDRg
00:42 good_news_everyon mojo/master fedce7c Sebastian Riedel: documentation tweaks
00:42 good_news_everyon left #mojo
00:55 asarch joined #mojo
00:57 * sri wonders if there's money in building something like this for mojolicious https://www.skylight.io/
00:58 sri https://pbs.twimg.com/media/BlhOmjuCcAAXaxr.png:large
01:44 genio mojolicio.us has a black cloud over it in my region. :(
01:56 klapperl joined #mojo
02:29 ivan joined #mojo
02:33 d4rkie joined #mojo
02:34 jberger genio: metacpan also has the doc if needed
02:42 jberger https://metacpan.org/pod/Mojolicious::Guides
02:43 sri i really hope p5-mop still becomes a thing
02:43 sri it may not be obvious, but the fact that it's using inside out objects would be life changing
02:44 sri (no more leaks!)
02:44 jberger that is not obvious to me
02:45 jberger why don't inside out objects leak?
02:45 sri our big problem is that stuff like callbacks is stored inside the object
02:46 jberger having never used inside out objects, how would they prevent that?
02:46 sri inside out object only has an id for the inside out store, there can't ever be circular references, since no data is stored with the object that's passed around
02:47 jberger oh huh
02:47 sri callbacks would be actually stored in some global namespace
02:47 jberger is there some hash that stores all the data?
02:47 sri yea, but it's far away from the object
02:48 sri doesn't have to be a hash, i guess an array would be faster
02:48 jberger oh, true
02:48 D4RK-PH0ENiX joined #mojo
02:49 sri downside of course is no introspection... you can't just dumper the object
02:49 jberger Data::Printer hooks could fix that
02:50 sri of course you could do stuff like dumper($object->inside_out_hash) or so
02:50 sri i kinda regret not having explored that further for Mojo::Base
02:51 * jberger worries about the wheels that are probably now spinning in sri's brain
02:51 sri oh, and another problem is need for more accessors, which cost *a lot*
02:52 sri one more thing p5-mop could fix
02:52 jberger autoload?
02:52 purl autoload is what causes it
02:52 sri nope, just accessors
02:52 sri they really add up
02:53 sri if you replace every $self->{foo} in mojolicious with a has '_foo'; you'd get maybe 50% slower overall
02:53 jberger oh, no direct access
02:53 sri yea, always one level of indirection
02:55 btyler joined #mojo
02:55 jberger as I have learned about the python object model I'm not surprised that perl beats it
02:55 jberger for speed
02:56 sri does it?
02:57 sri although... i guess futures work if you make them inside out objects :o
02:59 jberger http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html
03:00 sri and now i wonder if the accessor overhead could be somewhat mitigated by using arrays for storage
03:01 sri although, method calls are really really really expensive
03:02 sri hmmmm... *only* 523 results for $self->{
03:02 sri :S
03:02 sri (in mojolicious)
03:02 jberger for inside out, are methods still package functions?
03:02 sri yes, all the same
03:03 sri just where you store your data changes
03:03 genio I sat in a talk Damian Conway gave on his Class::Std  inside-out stuff.  I didn't exactly understand the benefits of it back then
03:03 jberger so the object is a blessed scalar?
03:03 jberger scalar reference
03:03 sri it could be, doesn't really matter
03:04 jberger sure
03:04 sri you just need to store your global id (which i believe is usually just the refaddr anyway)
03:04 sri oh
03:04 sri now that you mention it, i guess you could keep the hash for private data
03:05 sri and move only stuff with accessors out
03:05 sri then put private data prone to leaks into private accessors :)
03:06 jberger every year or so I try to make an object system based on blessed sub refs
03:07 jberger makes quite a mess
03:08 genio maaaan.  lots of the web is dark to me tonight.  mojo, fontello, icomoon, duckduckgo, etc.  it's a sign that I should just sleep
03:08 jberger my goal is always perfect privacy
03:09 sri genio: if you're with comcast maybe that's classified as premium content now :p
03:09 jberger genio have you tried a different dns?
03:10 jberger Google runs several
03:10 jberger 8.8.8.8 , 8.8.4.4
03:11 jberger sometimes a major provider has dns go down
03:11 jberger I've had it happen
03:13 genio I think it's something else.  I can resolve an IP for all stated sites, I just can't get a response from them.
03:13 genio mojo: 88.198.24.70  can't get a response by IP or name
03:13 jberger wow, that's odd
03:14 jberger where are you?
03:14 genio Gainesville, FL.   Cox communications as a provider
03:14 genio should go up through Atlanta, GA
03:15 * jberger was thinking Ukraine :-P
03:16 jberger my sister was living in Cairo during the first revolution when the gov't turned off the internet
03:26 sri hmmmm
03:26 genio that would suck.  I don't have those problems... I've got 1st world problems
03:26 sri a Mojo::Promise that used inside out storage could solve all our circular reference problems :O
03:27 sri you'd never again have to weaken anything
03:29 genio What about more basic stuff... Does each inside-out object then have to define it's own deep-copy method?
03:29 genio bah, I'll quit asking dumb questions and go do some research
03:34 zivester joined #mojo
03:49 irq joined #mojo
03:56 sri i'll be damned
03:56 sri it's confirmed
03:56 sri i made a delay patch for active leak protection
03:57 sri http://pastie.org/9114060 # this doesn't leak anymore
03:59 sri http://pastie.org/9114062 # patch for leak protection
04:00 sri you'd have to work really hard to make delays leak with that patch
04:09 good_news_everyon joined #mojo
04:09 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/wyqKtA
04:09 good_news_everyon mojo/master 0caa913 Sebastian Riedel: improved Mojo::IOLoop::Delay with circular reference protection
04:09 good_news_everyon left #mojo
04:10 sri it's actually pretty remarkable, just use delays and suddenly you're protected from the usual closure leaks
04:10 sri if we used promises everywhere we could get the same grade of protection for all non-blocking apis
04:11 sri (inside out promises that is)
04:14 sri actually i think i tried that a few years ago too with eventemitter, but i didn't grok the concepts enough to get it right at the time
04:16 sri jberger, tempire, marcus, crab: sooo i've just confirmed that inside out promises would mean we never have to worry about weaken for closures again :o
04:16 sri if you think it's worth a huge breaking change speak up
04:18 sri to do promises right we would need a) an inside out promise class, b) new methods in Mojo::UserAgent for non-blocking operations, and c) change all the callback using non-blocking apis away from taking a callback argument to returning a promise
04:19 sri d) get rid of delays
04:20 sri there are alternative scenarios too... like get rid of delay, keep all the current non-blocking apis, but use promises the verbose way
04:20 sri i'd like to get it right though, if we do it
04:21 good_news_everyon joined #mojo
04:21 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/ZAUvHQ
04:21 good_news_everyon mojo/master 85db3b1 Sebastian Riedel: fixed typo
04:21 good_news_everyon left #mojo
04:24 sri i'm sure batman has something to say about it too... considering how many hours he spends hunting leaks ;p
04:24 firnsy sri++ # on robustness of research and dedication for getting it right
04:25 sri the reality :) http://www.angelfoodcomic.com/wp-content/uploads/I-have-no-idea-what-I-am-doing.jpg
04:58 tianon man, I really love Mojo::URL and Mojo::UserAgent so much
04:58 tianon especially when I hit some service that only has some hunky AJAX api they interact with via JavaScript
04:59 tianon so nice for whipping up some quick scripts to just consume some data real fast
05:35 d4rkie joined #mojo
05:53 sujithm joined #mojo
06:08 irq_ joined #mojo
06:36 dod joined #mojo
06:55 Vandal joined #mojo
07:05 ladnaV joined #mojo
07:10 Vandal joined #mojo
07:26 eugen joined #mojo
07:41 sh4 joined #mojo
07:44 sujithm joined #mojo
07:49 sujithm joined #mojo
07:52 babl joined #mojo
07:54 basiliscos joined #mojo
08:06 fhelmber_ joined #mojo
08:21 met joined #mojo
08:22 Vandal joined #mojo
08:24 met1 joined #mojo
08:43 denis_boyun joined #mojo
09:01 denis_boyun_ joined #mojo
09:28 sujithm joined #mojo
10:24 abra joined #mojo
10:28 meshl joined #mojo
11:08 Akron joined #mojo
11:27 ladnaV joined #mojo
11:39 punter joined #mojo
11:46 abra joined #mojo
11:52 maxhq joined #mojo
11:53 abra_ joined #mojo
12:04 sri *crickets*
12:24 d4rkie joined #mojo
12:30 DaniBunny joined #mojo
12:38 d4rkie joined #mojo
12:47 asarch joined #mojo
13:26 mire_ joined #mojo
13:30 met joined #mojo
13:39 basiliscos joined #mojo
13:42 neyasov_ joined #mojo
13:42 * sri would have expected a little more interest in getting rid of weaken
13:51 DaniBunny joined #mojo
13:54 rem_lex| joined #mojo
14:01 neyasov_ joined #mojo
14:04 DaniBunny joined #mojo
14:11 genio sri: I still haven't found a complete inside-out implementation.  Everything in the CPAN is old and has caveats that seem to be too much to rely on.
14:14 sri p5-mop is the best implementation of inside out objects
14:14 sri but for mojolicious it doesn't matter, we only need to selectively store a few things indide-out
14:14 sri full inside-out objects would be a waste
14:45 neyasov_ joined #mojo
14:45 jberger wow
14:45 jberger Cool
14:46 neyasov__ joined #mojo
14:47 jberger I'm not sure what to say exactly
14:48 jberger I think that large changes to the logic of the most complicated parts of an application (Nonblocking) will be a barrier to adoption
14:49 * sri is currently exploring less radical solutions
14:49 jberger but then again mojolicious' commitment to breaking compatibility for improvement is how it has become so great so fast
14:49 sri inside-out storage for Mojo::EventEmitter could solve *a lot* of problems
14:50 jberger that does sound promising
14:50 sri (i have it mostly working... just tracking down some garbage collection problems now)
14:50 jberger go sri go!
14:51 neyasov__ joined #mojo
14:51 sri i think there's some unrelated leak somewhere that the old weaken code masked
15:00 DaniBunny joined #mojo
15:04 Akron That looks great! I thought that passing only refaddr would make manual garbage collection necessary - but deleting everything when the scalar ref dies is pretty simple.
15:04 Akron sri++ Great idea, great work!
15:06 abra_ joined #mojo
15:19 sri interesting, one feature depended on leaks
15:27 batman sri: you will be so drunk while going to the mojoconf if you remove the need for weaken()
15:28 batman :)
15:28 batman as in... that would be the most awesome thing since... i'm not sure.
15:29 jberger sri: what feature?
15:29 purl rumour has it feature is see bug
15:29 jberger purl: hahaha
15:29 purl jberger: huh?
15:30 * jberger punches purl in the nose
15:30 batman i've been travelling, so i haven't had time to give feedback on the inside-out "news" yet
15:31 batman i don't get it though how it can work though :(
15:31 stephan48 what does "inside-out objects" mean? what did i miss?
15:33 batman stephan48: package Foo; my %o; sub new { my $self = bless {}, shift; $o{$self} = {@_}; return $self; } sub my_attr { $o{$_[0]}{my_attr} }
15:33 batman ^ something like that...
15:33 stephan48 wtf?
15:33 batman you don't really store the data in the object, but in a "global" hash instead
15:33 stephan48 what is the advantage?
15:33 purl the advantage is probably we'll get it done on time, under budget, and with 50% more blow jobs!
15:34 sri nope, that's not how it works
15:34 stephan48 oh and yea, how does it work?
15:34 sri well, almost
15:34 batman it doesn't ...?
15:34 sri actually... ignore me... my mind is somewhere else ;p
15:34 stephan48 the hash is local to Foo, or rather the "required instance of Foo"
15:34 stephan48 as far as i understand it
15:35 batman what do you mean?
15:42 Vandal joined #mojo
15:52 sri it's funny though... atm i'm adding more wekan calls instead of removing them because i found old leaks :S
15:55 batman i think it's sad. too bad we have to worry about it at all :(
16:02 batman stephan48: i think my understanding of inside-out is shallow... i don't get how it can avoid weaken if i works like i think :(
16:03 stephan48 batman: i think it works because $self has nothing attached to it
16:03 stephan48 you just pass an "identifier" around for accessing the actual data
16:04 stephan48 unless now when $self contains all data
16:04 stephan48 have to go now throu
16:04 batman i get how $self doesn't leak, but i don't get why %GLOBAL_STUFF can't have circular refs if callbacks are closing over it self
16:05 batman sri: i don't mind breakage if you can avoid weaken()... maybe unless it's huge changes
16:06 batman if it means major rewrites for all end users, then i think you should fork Mojo to Leek or something :)
16:06 sri if callbacks are closing over themselves you're scrwed no matter what
16:06 batman ok.
16:06 batman then i might still understand it :)
16:06 sri this is about objects and closures
16:07 sri $foo->on(bar => sub { $foo->this would normally leak() })
16:08 batman is the difference between $REMAINING{refaddr $obj} and $REMAINING{$obj} that you can rebless $obj and still have the same refaddr() ..?
16:08 batman "normally leak" ..? but doesn't..?
16:09 sri with inside-out storage that no longer leaks
16:09 batman that is super cool :)
16:09 sri because the closure is not stored inside the object
16:09 batman i see
16:10 batman http://pastie.org/9114062#17 <-- do you consider this potentially bad change?
16:11 batman i would guess that it doesn't work if someone override DESTROY or poke inside the object...
16:11 batman anything else..?
16:11 purl rumour has it anything else is going to be even worse
16:12 sri if you override DESTROY you leak, which can be potentially hard to detect
16:12 batman indeed. and i guess a lot of modules do override DESTROY. (i know i often do)
16:12 batman maybe you should add DEMOLISH or something to Mojo::Base :)
16:13 sri but seriously, if you ignore the DESTROY in a base class you deserve what you get
16:13 batman i agree.
16:14 batman ...you could add a timer event which periodically remove "old" datastructures from %REMAINING
16:14 batman j/k
16:14 batman but isn't that how python does it..?
16:18 * tempire answers with a promise
16:18 batman $bar->foo($foo); $foo->on(bar => sub { $bar->this_still_leak() }) ...?
16:18 batman (foo() is an attribute)
16:19 tempire the promise will be fulfilled this evening
16:19 * batman is super tired
16:33 * sri thinks it might be worth adding a generator for inside-out attributes to Mojo::Base
16:39 drift joined #mojo
16:40 neyasov__ joined #mojo
16:47 batman +1
16:47 purl 1
16:49 denis_boyun joined #mojo
17:04 sri i guess the reactor could use inside-out storage too
17:26 gryphon joined #mojo
17:33 sri yea, reactor was easy
17:39 sujithm joined #mojo
17:40 sri damn
17:41 sri of course it does not work for eventemitter
17:42 sri or the reactor
17:42 purl the reactor is the event loop no?
17:43 sri *facepalm*
17:43 sh4|2 joined #mojo
17:44 sri since DESTROY needs to be called for stuff to be cleaned up... as long as the closure references the object that just never happens
17:44 sri interesting chain
17:44 sri it works for delays because you never pass $delay into steps
17:51 good_news_everyon joined #mojo
17:51 good_news_everyon [mojo] kraih pushed 1 new commit to master: http://git.io/ESAkEw
17:51 good_news_everyon mojo/master 920fb56 Sebastian Riedel: fixed memory leak in Mojo::UserAgent::Server
17:51 good_news_everyon left #mojo
17:52 sri what a waste of time :(
17:55 sri promises might still work though... for the same reason delays still work
18:16 mire_ joined #mojo
18:46 alnewkirk joined #mojo
18:56 asarch joined #mojo
19:07 sri yea, confirmed, it does work very well with promises
19:07 sri and i have a prototype
19:08 sri that means if we break all the non-blocking apis we can get rid of weaken
19:10 sri http://pastie.org/9115452 # my little prototype
19:10 sri no wait :o
19:14 sri yes, confirmed, it works
19:14 sri no leaks at all
19:17 sri http://pastie.org/9115467 # the promise implementation
19:17 sri and the get_later from Mojo::UserAgent http://pastie.org/9115469
19:21 sri so with promises we could make all the plain callback apis work (replacing every single one of them)
19:21 sri that leaves of course the callbacks that get invoked more than once
19:22 sri a Mojo::Supply class could wrap those with the same trick
19:22 sri all apis would change though
19:23 sri my $supply = $ua->on('start'); $supply->tap(sub {...});
19:23 sri this also affects stuff like hooks
19:24 sri app->hook('before_render')->tap(sub {...})
19:25 sri (hooks are implemented with Mojo::EventEmitter... which has to change the most drastically)
19:27 gryphon joined #mojo
19:31 sri jberger, tempire, marcus, crab: ok, i think we have all information now to make a decision
19:40 dotandimet joined #mojo
19:53 jberger so what happens to get( ... => sub {} )?
20:00 sri jberger: what do you think should happen to it?
20:04 sri and don't forget we have apis like this too http://mojolicio.us/perldoc/Mojo/IOLoop#client
20:04 webart joined #mojo
20:04 sri or even http://mojolicio.us/perldoc/Mojo/IOLoop#timer
20:05 sri no idea how a promise would fit in there
20:15 jberger are you saying that the plan is to support both patterns for now? you know I'm ok with that
20:16 sri i'm saying there is no plan
20:17 sri we have to make a plan
20:19 sri do we want weaken to go away? do we want to teach users multiple different ways to do non-blocking?
20:20 sri the price is very very high for making weaken really go away, everything from user agent to reactor would change
20:20 sri so far all i've done is to prove it can be done
20:21 sri we would need Mojo::Promise and a similar Mojo::Supply, and then use both on all layers, basically for everything that uses a callback now
20:29 sri that's the real decision we all need to make
20:29 * sri pokes jberger, tempire, marcus and crab again
20:30 nic Is there a performance penalty?
20:30 sri i have another intersting hack too btw
20:30 sri nic: of course, there's a new level of indirection
20:31 nic So coding would be quicker (less looking for leaks) but apps might show a performance hit
20:32 sri not sure it matters much, every ->then() costs two objects and maybe a dozen method calls
20:32 nic If only promises was documented (no delays) is concurrency easier for beginners to understand?
20:32 sri nic: i've been asking that for the past week ;p
20:32 nic :)
20:33 sri the fact that weaken would not be required sure should help beginners though
20:34 sri you distracted me from the other interesting hack though ;p
20:34 nic yeah, that's quite a hurdle, and sometimes a mind-bender when you have pressure to 'just fix it'
20:34 sri normal callbacks can be guarded from leaks too
20:34 nic ooh, how?
20:35 nic (so far this has a strong smell of The Right Way to Go, Even Through Short-term Pains)
20:36 sri you'll laugh
20:37 sri http://pastie.org/9115605
20:37 sri it's literally a guard
20:37 sri a closure wrapped around the real closure protecting it with indirection, it gets cleaned up with $delay
20:38 nic I'm not following 'guard'
20:38 nic (it's implementation)
20:39 nic oh
20:39 nic ah
20:39 nic So with disciplined use of guard, we could protect from (closure) leaks without causing riots in the streets?
20:40 sri ->guard() is not a serious proposal ;p
20:40 sri delays already protect from closure leaks
20:40 sri (since yesterday)
20:41 sri this change has proven effective https://github.com/kraih/mojo/commit/0caa9135ae85f6a413fe0483e526e69e7e808ba3
20:43 nic (oh, I missed yesterday; while waiting for soup to simmer I thought I'd shortcut to today)
20:44 nic So does that mean that adopting promises isn't as big a win as it would have been (before yesterday)?
20:45 sri it's very complicated
20:45 sri if you use delays, you're protected from closure leaks since yesterday
20:48 sri of course, that doesn't cover Mojo::EventEmitter and all the countless ->on() events with it
20:49 sri that could be addressed with a perl6-ish Mojo::Supply (using the same trick as Mojo::Promise)
20:49 sri http://perlcabal.org/syn/S17.html#Supplies
20:50 genio I've been reading on p5-mop and I have to say, I like the syntax
20:52 sri btw. ->guard does not appear to actually work
20:57 * nic is finding the perlcabal link too interesting
20:58 nic I must read more of it tomorrow; then search if anyone's done the Scheduler stuff in p5
21:01 sri i would think so, considering moarvm and jvm backends have working support for threads
21:02 sri i guess that's a no ;p https://github.com/rakudo/rakudo/blob/nom/src/core/Scheduler.pm#L21
21:04 meshl joined #mojo
21:04 sri or actually... there it is :) https://github.com/rakudo/rakudo/blob/nom/src/core/ThreadPoolScheduler.pm#L67
21:06 nic thanks for that
21:12 jberger If you are not opposed to keeping both interfaces around for a while, I would support that idea
21:12 jberger I'm curious to see the uptake on promises (mine included) before I would recommend moving away from delays
21:12 sri jberger: how would that work?
21:13 jberger get_later
21:13 sri i mean on all the other layers
21:14 sri how would eventemitter do callbacks and supplies?
21:14 jberger I'm going to have to read up on supplies :-)
21:14 sri and the differen Mojo::IOLoop methods
21:14 jberger I'm only just starting to get my head around returning promise objects
21:15 sri http://perlcabal.org/syn/S17.html#Supplies # it's not very hard
21:16 sri signals for example are a supply in perl6
22:33 d4rkie joined #mojo
22:45 cpan_mojo joined #mojo
22:58 punter joined #mojo
23:08 punter sri, I believe that executing $p->then($sub) should execute &$sub if the promise is already resolved
23:08 punter but not 1000% sure
23:08 punter Mojo::Promise is very nice! :-)
23:08 punter o, you do that already. Sorry
23:26 btyler joined #mojo
23:48 tempire is there no longer anything preventing a mojolicious port to perl6?
23:56 sri i'm sure there are smaller things still missing, but no big blockers anymore i believe
23:56 sri although, a direct port would suck, a lot of things need to be redesigned

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary