Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2010-01-10:

[16:04] <Wes-_> anybody here hacked on jsdoc-toolkit?
[16:05] <ashb> breifly
[16:06] <Wes-_> I'm trying to figure out why I'm getting 'Couldn't create the required templates: TypeError: this.template.replace is not a function' on my hacked up version
[16:06] <Wes-_> (hacked up to run on gpsee)
[16:07] <Wes-_> weird thing is, I can't find where it's *calling* that from
[16:07] <ashb> print e.stack ?
[16:07] <Wes-_> BTW, 98% of my port is covered by fs-base
[16:07] <Wes-_> ashb: Hmm, it's not propagating to uncaught, but maybe I can at least find the catch!
[16:09] <Wes-_> ashb: Hmm, it's not propagating to uncaught, but maybe I can at least find the catch!
[16:09] <Wes-_> oops, wrong window lol
[16:09] <ashb> wrong window :)
[16:09] <ashb> alt-tab,up,enter :)
[16:09] <Wes-_> yep!
[16:09] <Wes-_> Now that's wierd. How can e.stack be undefined?
[16:10] <ashb> throw "foo"
[16:10] <ashb> ?
[16:10] <ashb> caught somewhere else?
[16:10] <ashb> (and then re-thrown as a string, not an Error)
[16:11] <Wes-_> wierd, maybe because it's a TypeError?
[16:11] <ashb> is it instanceof Error?
[16:11] <Wes-_> Anybody know the precise behaviouro f the rhino load() function?
[16:12] <ashb> think its fairly similar to `js` load() but dont know for certain
[16:12] <Wes-_> ashb: Yeah, I replaced it with gpsee's include function which runs in global scope
[16:12] <Wes-_> maybe I need to replace it with eval(readAll)
[16:12] <Wes-_> interesting, TypeError is not instanceof Error
[16:13] <ashb> > (new TypeError) instanceof Error
[16:13] <ashb> true
[16:13] <ashb> interesting indeed
[16:15] <Wes-_> Wait, doing eval inside load() eval in the load function's context
[16:15] <Wes-_> how the heck do I emulate this?
[16:30] <Wes-_> okay, I seem to get the most detailed error message when load() modifies the global object, so I'm guessing that's the right behaviour
[16:31] <Wes-_> other attempt was modifying arguments.callee.caller
[16:33] <Wes-_> anybody ever run jsdoc-toolkit in strict mode?
[16:35] <Wes-_> and does anybody understand the purpose of the idiom function(X) { var X; } ??
[16:37] <inimino> Wes-_: no purpose
[16:37] <Wes-_> inimino: that was my immediate thought, but this code is *littered* with it. Wierd!!
[16:38] <inimino> Wes-_: most likely someone was confused and thought the var statement was necessary
[16:38] <Wes-_> Considering this is the author of jsdoc-toolkit... you'd think he would be firmer on js syntax. ;)
[16:39] <Wes-_> or maybe it's some wierd hackiness for a broken static analysis tool?
[16:39] <ashb> i'll get someone to ask him on monday
[16:39] <inimino> who knows :)
[16:39] <ashb> he works at the BBC with some of my friends
[16:39] <ashb> Wes-_: got a url so i can point someone at an example?
[16:44] <Wes-_> ashB: http://code.google.com/p/jsdoc-toolkit/source/browse/trunk/jsdoc-toolkit/app/run.js#201
[16:46] <ashb> Wes-_: so i take that duplicate var was causing a warning for you?
[16:47] <Wes-_> ashb: Yeah. Several other cases, too, hard to find the specific ones ,though, because that code is crazy full of warnings (mostly accesses to undeclared global variables or object properties)
[16:47] <Wes-_> *ouch* - I haven't even got this running yet and have ~4000 lines of warnings
[16:47] <inimino> I would guess that's just there for consistency's sake
[16:47] <ashb> // warnings: no
[16:47] <ashb> i've found that to be very useful :)
[16:47] <Wes-_> well, they're turned on for a reason right now, lol
[16:48] <ashb> yeah - probably need to add finer granularitiy then all or nothing
[16:48] <inimino> hehe
[16:48] <Wes-_> so the current bitching is "this.template.replace" is not a function. "this.template" appears to be a string. *hmm*
[16:48] <ashb> typeof this.template === "string" ?
[16:48] <Wes-_> oh no, it's undefined!
[16:48] <ashb> or its just getting coerced somewhere?
[16:49] * Wes-_ got mixed up in the lines and lines of warnings. ;)
[16:49] <inimino> trying to use JSLint on code that wasn't written in Crockfordian style is more likely to introduce errors than remove them, in my experience...
[16:49] <Wes-_> "why is it undefined" might be tricky, though. *hmmm*
[16:49] <ashb> the warnings are from spidermonkey strict mode here
[16:50] <inimino> ashb: oh...
[16:50] <Wes-_> inimino's got a point, though, I stuck in so "var" statements to get it to STFU and actually broke the behaviour
[16:50] <inimino> Mozilla's strict mode had some really unfortunate choices too
[16:50] <ashb> inimino: yeah.
[16:50] <Wes-_> guessing that "IO = {}" must declare a global and I bound it to function-scope or something silly like that
[16:51] <ashb> sounds quite likely yeah
[16:51] <Wes-_> fwiw, moz's strict mode is getting ready to converge with "use strict" IIRC
[16:51] <inimino> I've seen people take code written by Brendan Eich, run in through JSLint, "fix" it, and then complain about it being broken
[16:51] <Wes-_> doesn't surprise me
[16:52] <Wes-_> in the motorcycle world, I have found that 99% of people's poor-running problems can be resolved by returning the carburetion, intake, and exhaust to the way the factory made 'em
[16:52] <inimino> yeah, they will have to remove some of the stupid tests from moz's strict mode to make it ES5 compatible
[16:52] <inimino> heh
[16:52] <Wes-_> added bonus: bike is no longer ear-splitting loud and gets better fuel economy!
[16:52] <Wes-_> (gosh oh golly!)
[17:01] <Wes-_> HAHAHA - I think I figured out my problem - my read-all function seems to be returning an array instead of a string
[17:01] <ashb> oh
[17:01] <ashb> that would behave quite odly
[17:03] <Wes-_> yeah, it was working okay, presumably parsing a bunch of wierd javascript -- one s tatement, lots of comma operators -- and failing when it needed String.prototype.replace()
[17:03] <Wes-_> ashb, does your fs-base have basic i/o?
[17:03] <ashb> define basic i/o
[17:04] <Wes-_> read, write
[17:04] <Wes-_> yielding bytestrings
[17:04] <ashb> fs.rawOpen returns a:
[17:04] <ashb> http://flusspferd.org/docs/js/flusspferd%20core/io/stream.html
[17:04] <Wes-_> btw, that should be openRaw
[17:05] <ashb> (technically its a file, but the file has no interesting methods for this)
[17:05] <Wes-_> good, that's close enough to what I have; I should be able to hack a version of this to work on both our platforms soonish
[17:06] <Wes-_> you tested yours much, btw?
[17:06] <ashb> worth pointoug out our char stream doesn't read X chars but X bytes
[17:06] <Wes-_> I haven't done much testing here
[17:06] <ashb> not many regression/unit tests, but used it lots
[17:07] <Wes-_> my stream object is kind of entertaining ATM, it just holds an FFI'd FILE *
[17:08] <Wes-_> all my byte->STring stuff is done with Binary/B
[17:08] <ashb> ditto
[17:10] * Wes-_ notices with amusement that his implementation of load() leaves behind pre-compiled js tokens
[19:08] <Wes-_> Yay!
[19:09] <Wes-_> I have jsdoc-toolkit running under gpsee!
[19:09] * Wes-_ ways goodbye to Rhino
[19:09] <Wes-_> er, WAVES goodbyte
[19:12] <Wes-_> ashb: do you have a contact address for micmath?
[19:13] <Wes-_> Ah, micmath@gmail.com seems to be the one
[19:55] <ashb> Wes-_: so jsdoc-tk doens't use rhino's AST at present?
[19:55] <Wes-_> ashb: it does not; they have been talking about it, but no action yet
[19:55] <ashb> ah
[19:55] <Wes-_> that toolkit could run on flusspferd without significant work
[19:56] <Wes-_> besides uname (which is probably cosmetic), I think the only thing I needed to write that wasn't commonjs was simple stream I/O and load()
[19:56] <ashb> now i just need a way if detecting when JSdoc is inuse and when pdoc is
[19:57] <ashb> oh and to port pdoc to JS
[19:57] <Wes-_> oh, also, arguments array from argv[] is not CommonJS on GPSEE ATM, I need to fix that, it's basically Rhino's impl ATM so I didn't need to monkey with that much
[19:58] <ashb> hmm?
[19:58] <Wes-_> why would you need to detect what's in use?
[19:58] <ashb> for the cpan-a-like
[19:58] <Wes-_> Ah, yes
[19:58] <ashb> i.e. a site that lets you view and interlink docs
[22:16] <jmerlin> ondras: around?

 

 

Logs by date :