If objects/values can be shared throughout a runtime, why do we need to supply a JSContext reference to create them? #1238
Unanswered
mrmbernardi
asked this question in
Q&A
Replies: 1 comment
-
|
For primitives, yes; or rather, it doesn't matter. For objects, no. For consistency, everything takes a pointer to JSContext, also because otherwise you get inconsistencies like: JSValue JS_NewBool(JSRuntime *rt, bool val);Vs. JSValue JS_ToBool(JSRuntime *ctx, JSValueConst val);The latter needs JSContext because the ToBool operation can invoke JS code. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
quickjs/docs/docs/developer-guide/intro.md
Lines 10 to 21 in ca0d50d
This implies I can pass objects around within the same
JS_RuntimeWhy then have a signature like this:
JSValue JS_NewBool(JSContext *ctx, bool val)Wouldn't this make more sense:
JSValue JS_NewBool(JSRuntime *rt, bool val)Beta Was this translation helpful? Give feedback.
All reactions