• Ahh, that's because doing:

    JsVar *x = jsvUnLock(jsvNewFromInteger(10));
    

    Would introduce a bug. When you jsvUnLock, if the amount of locks and references equals 0 then the variable will be freed, so what you're left with will just be an unused variable. (a 'new' variable will have one lock, and no references).

    It's a bit like asking why you can't do:

    void *foo = free(malloc(50));
    

    There are a very few cases where you could do what you suggest, but 90% of the time it'll introduce a bug, which is why it got left off :)

About

Avatar for Gordon @Gordon started