Spidermonkey has a config option 'JS_HAS_LVALUE_RETURN' that lets native functions return an lvalue. Currenty all versions of javascript that it can build have this flag enabled.
It lets you define functions that return references directly as long as you define them in C.
I presume someone found a use for it at some point, but it does lead to deferring the SyntaxError until runtime.
3 comments:
Umm, I don't get it I guess, but why should you be able to assign 10 to the print function?
You shouldn't, of course. What's fascinating, though, is that a SyntaxError is a runtime exception. Notice how in the first call, no error occurs.
Spidermonkey has a config option 'JS_HAS_LVALUE_RETURN' that lets native functions return an lvalue. Currenty all versions of javascript that it can build have this flag enabled.
It lets you define functions that return references directly as long as you define them in C.
I presume someone found a use for it at some point, but it does lead to deferring the SyntaxError until runtime.
Post a Comment