On 20-Sep-05, at 12:26 AM, Rob Kinyon wrote:
> On 9/19/05, Laurie Harper <
lau...@holoweb.net> wrote:
>> [First off, is there a better way to submit bug reports than this
>> list?]
> Nope.
OK, at least I asked ;-)
>> The current distribution of Object.extend (0.02) appears to be
>> broken. When I call JSAN.use('Object.extend') it complains that JSAN
>> must be loaded first. Clearly it was, or the call to use() wouldn't
>> have worked ;-)
>
> Yeah, I'm running into this bug in Object.extend(),
> Number.toColorPart(), and the whole Upgrade suite. I haven't had a
> chance to pin down exactly why the bug is happening and Casey's wife
> just had a baby, so he's mostly out of it.
>
> Would you be able to create a testcase using Test.Simple for me to try
> and patch JSAN against?
I'll take a look at that; in the meantime, I can offer a couple
points of guidance:
1) the use() in Object.extend.js is wrapped in a try/catch which just
assumes *any* error must be due to JSAN not having been loaded. The
right thing to do is probably to change this:
try {
JSAN.use( 'Upgrade.Function.apply' );
} catch (e) {
throw "Object.extend requires JSAN to be loaded";
}
to this:
if (JSAN == undefined) {
throw "Object.extend requires JSAN to be loaded";
}
JSAN.use( 'Upgrade.Function.apply' );
That will let the correct error be propagated. Which leads to the
next problem... That use() call is failing because Upgrade/Function/
apply.js (a) assumes the Upgrade and Upgrade.Function namespaces are
defined (and I can't figure out what does that; the Upgrade package
doesn't, which is where I'd expect it to happen...); and (b) doesn't
define a class, so the result of eval()ing it is not what JSAN
expects. JSAN needs to be made a little more robust against this, and
the apply.js needs to return (or eval to) the right kind of object.
Problems in Number.toColorPar() are probably similar.