Hopbot log for 2007-07-27 - Helma IRC channel: #helma on irc.freenode.net

2007-07-27:

[22:05] <jsp> HopObject.forEach doesn't seem to exist
[22:06] <jsp> but it's in the docs... so is it really there and I somehow got rid of it on my prototype inheriting from HopObject, or is that a doc-o-blooper?
[22:30] <jerakeen> it's a JS built-in
[22:30] <jsp> not on HopObjects it's not
[22:30] <jsp> only on arrays
[22:30] <jsp> (HopObject doesn't extend array)
[22:31] <jsp> I've just added it to the prototype for now using a modification of the forEach code from Mozilla
[22:32] <jerakeen> doh.
[22:34] <jsp> the docs' description of HopObject.forEach was seriously weird, anyway. If it was correct, it's just as well that it doesn't work :-)
[22:57] <zumbrunn> jsp, it's a glitch in the docs
[22:57] <jsp> which part?
[22:57] <zumbrunn> there is a forEach method for the HopObject, but it's not part of Helma core
[22:57] <zumbrunn> http://adele.helma.org/source/viewcvs.cgi/modules/core/HopObject.js?rev=1.6&content-type=text/vnd.viewcvs-markup
[22:58] <zumbrunn> it's part of the /modules/HopObject.js repository
[22:58] <zumbrunn> (and therefore optional)
[22:59] <jsp> ah. so all the _macro stuff isn't in my HopObject either?
[22:59] <jsp> (I wouldn't have noticed, since I'm not using skins)
[22:59] <zumbrunn> not unless you include that file repository
[23:00] <jerakeen> I think the Array forEach passes the array itself as a third param to the callback.
[23:01] <zumbrunn> yes
[23:01] <jsp> forEach is too darn useful--should be in core, and should be done fully compatible with Array.foreach
[23:01] <zumbrunn> element,index.array
[23:01] <zumbrunn> element,index,array
[23:02] <jsp> and also myArray.forEach(whatever,obj) makes obj 'this' for whatever
[23:02] <zumbrunn> forEach for arrays is in core, of course
[23:02] <jsp> I put in a bug report
[23:02] <zumbrunn> what?
[23:03] <zumbrunn> the suggestion to add a foreach for HopObject as part of core?
[23:03] <jsp> before you replied, I put in a bug report saying that HopObject.forEach should exist *and* should copy Array.forEach
[23:04] <zumbrunn> oh, didn't see that yet
[23:04] <jsp> so the copy Array.forEach part is definitely still valid
[23:06] <jsp> http://helma.org/bugs/show_bug.cgi?id=537
[23:16] <jsp> ok, if I haven't explicitly included any core modules, how come obj.clone works?
[23:18] <zumbrunn> maybe you included a module that depends on ./modules/core/Object.js ?
[23:18] <jsp> only repo I added was app.addRepository("modules/helma/File.js");
[23:19] <zumbrunn> and helmaTools ?
[23:19] <jsp> oh, yeah
[23:19] <jsp> forgot about that :-)
[23:20] <zumbrunn> it's not really nice that helmaTools would have dependencies like that, though
[23:20] <zumbrunn> since they likely will not be there during deployment
[23:20] <jsp> yeah
[23:20] <jsp> just what I was thinking
[23:21] <jsp> I'm not sure I understand why these aren't just included all the time, though
[23:21] <zumbrunn> you are free to include them all the time :-)
[23:21] <jsp> and so I suppose I shall, but it's a pain to have one more thing to remember to do for each app
[23:22] <jsp> can I include the whole lot of them in one command.. ah
[23:22] <jsp> with all.js, I suppose
[23:22] <zumbrunn> sure
[23:23] <zumbrunn> you can also write your own version of an "all.js" that includes everything that you always want to have in your toolbox
[23:24] <jsp> sounds like the way to go
[23:27] <jsp> incidentally, in the existing HopObject.forEach code, this.count() is used in the for loop. which would seem to mean it gets called for each time through the loop, which seems very wasteful, since calling a method can't possibly be as cheap as local variable access, right?

 

 

In the channel now:

Logs by date: