why Mojo::IOLoop::Delay uses ioc?

50 views
Skip to first unread message

s...@alexbyk.com

unread,
Mar 12, 2015, 8:28:00 AM3/12/15
to mojol...@googlegroups.com
Hi. Sorry for stupid question

Can somebody explain me why Mojo::IOLoop::Delay uses Hash::Util::FieldHash instead of normal attr?

From the doc.
Remaining "steps" in chain, stored outside the object to protect from circular references.

How does that protect from circular references? This confuses because you may think that refs are weakened and
you can use it as a closure like

my $d = Mojo::IOLoop::Delay->new;
$d->steps( sub { $d->pass; });
 
But you can't, because it has the same effect as $d->{remaining} = [sub {$d}].

I thought a lot about why this solution was chosen, I have only one idea: you can destroy all steps from all delays, but I don't think that this is the reason because access to the %REMAINING isn't implemented at all

So maybe I miss a point... or maybe this is a mistake?

s...@alexbyk.com

unread,
Mar 12, 2015, 3:09:12 PM3/12/15
to mojol...@googlegroups.com
Any answer?)  :-(

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious...@googlegroups.com.
To post to this group, send email to mojol...@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages