Re: [Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-31 Thread Sanford Whiteman
Count the actual # of times each instantiation is attempted: 5x, 13x, 28x, 49x... as the match index gets further away. It's not that you don't get the right one at the end, it's what it takes to get there. -- S.

[Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-31 Thread jiggliemon
I'm not sure I follow. Currently, it will only "try" so long as i < array.length, Other wise we throw an error. The loop breaks and returns an instance on which ever attempt is successful. Here's an example w/ the standard XMLHttpRequest as 3rd in the array. This shold find a working instance afte

Re: [Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-31 Thread Sanford Whiteman
> I moved the return back into the Try, and it works. For what ever > reason, it didn't work before, works now. Well, with your refactoring, you changed the scope chain around. But your new version attempts to instantiate at least 1 unnecessary object and possibly well more than i^2 extr

[Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-30 Thread jiggliemon
I moved the return back into the Try, and it works. For what ever reason, it didn't work before, works now. Of couse I only tried on Chrome and FF. Both take option 1. http://jsfiddle.net/jiggliemon/b5LaZ/1/ So ultimately, the Finally is overkill. But I still like using Finally. You don't ge

Re: [Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-30 Thread Sanford Whiteman
> Huh? Works perfectly for this case. (step into it as it recurses and you can see why)

Re: [Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-30 Thread Sanford Whiteman
> [finally] is basically useless. Huh? Works perfectly for this case. -- S.

[Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-30 Thread jiggliemon
@chris: I had looked at that earlier. At heart it's what I'm trying to do, my real only goal is to use a self-referential loop - fo no other reason other than as an exercise. This xhr loop simply looked like the perfect place to start. On Jul 30, 10:53 pm, Christoph Pojer wrote: > Note that

[Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-30 Thread Christoph Pojer
Note that finally is always executed, even after entering a catch blog. It is basically useless. For your specific XHR problem, you may want to look at this snippet from MooTools Core: http://github.com/mootools/mootools-core/blob/master/Source/Browser/Browser.js#L66-91 On Jul 30, 8:39 am, jiggl

[Moo] Re: Playing around with the Factory pattern. I'm stumped.

2010-07-29 Thread jiggliemon
Thanks. http://jsfiddle.net/jiggliemon/b5LaZ/embedded/ -Chase On Jul 29, 2:09 pm, Sanford Whiteman wrote: > > So I thought what a great time to use a self-referential function. > > However I can't seem to get it to work.  Does anyone have insight as > > to how/if at all, this could work? > >http