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 :)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Ahh, that's because doing:
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:
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 :)