Thanks Christopher,

On 26/02/2011, at 3:47 PM, Christopher Wright wrote:

Can anybody explain to me why I am getting a 'no default value error' all the time it's killing me?
function (__structure Out) main (__structure Input)
{
        var result = new Object();
        if (!_testMode && Input) {
                CR = String.fromCharCode(13);           
Log(CR+CR+CR+"#### Test this error that says \"TypeError: No default value\" ####"+CR)
                for (i in Input)
                {
                        _in = Input[i];
/*
                This line works:                        
*/
                        Log (i+":  _in: ");
/*
                These line doesn't!
                        Log (i+":  _in: "+_in);           <—— Here
                        Log (i+":  _in: "+Input[i]);      <—— And here !
*/
                }       
                result.Out = true;
        }
        return result   <--- missing a semicolon! ;)
}

Composition is attached for testing.

Don't use CR like that -- "\n" will do you just fine (as in "\n\n\nA line with 3 empty lines above it!\n\n\n").
Thanks. Yes, me no have C/shell bkgd to speak of, sir! Will do.


_in and Input[i] (which are the same thing) are JS objects. More specifically, they're structures (you're passing in a structure of structures).

Log(i+": _in:"+typeof(_in)); will tell you it's an "object" (which can't generally be logged). Log(i+": _in:"+_in[0]); will print the first value of each substructure (which happens to be a number, which is OK for logging).


On a side not I just found that my often cited problems with the JS patch not parsing perfectly good code (as delete everything except for four lines of code) can be got around sometimes by doing the save, close comp, open comp shuffle. Doesn't always work though :/ Perhaps this got fixed on 10.6 so I sound like an idiot talking to himself?

I've not seen this even on my 10.5 machine (and I've cut pages and pages and pages of JS code on that machine in QC). You're omitting a semicolon on the return statement (so while the code is valid JS, it's not as nice as it could be).

Okay, this was deliberate. I was under impression that it's bad style (read not required therefore superfluous) to put semicolons after statements preceding braces most common example of which is return statement. I'l semicolon every line then.




You're also assigning a boolean (true) to a value (Out), but telling QC that it should expect a Structure (__structure). This won't bother JS, but it might confuse QC.

Ok

Still waiting for reliable steps to recreate this parse problem you allude to -- perhaps it's PPC specific?
I've actually not got close enough to it to think about recreating on command. If the close, open trick is consistent (in case when I haven't just butchered my code), I'l then try and recreate. Don't code enough JS concurrently to tell.

If so not worth the candle I guess, I'll be off it PPC of these days. Especially if Lion has native versioning, is it multiuser versioning (like other versioning frameworks) or just straight single user (ie. generates conflicts etc)?


--
Christopher Wright
christopher_wri...@apple.com




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to