Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need new enum cases in JSValue for closures? #118

Open
MaxDesiatov opened this issue Jan 18, 2021 · 2 comments
Open

Do we need new enum cases in JSValue for closures? #118

MaxDesiatov opened this issue Jan 18, 2021 · 2 comments
Labels
question Further information is requested

Comments

@MaxDesiatov
Copy link
Contributor

Now that JSClosure and JSOneshotClosure are no longer subclasses of JSFunction, how are they supposed to be converted to JSValue? Should the object case be used?

@MaxDesiatov MaxDesiatov added the question Further information is requested label Jan 18, 2021
@kateinoigakukun
Copy link
Member

I think the object case should be used for this purpose because we don't need to distinguish object case and closure case internally. If you want API consistency, we can add a new static func instead of a new case.

static func closure(_ closure: JSClosure) -> JSValue { .object(closure) }

@MaxDesiatov
Copy link
Contributor Author

MaxDesiatov commented Jan 19, 2021

Yeah, that would make sense, I can see people being confused when there is JSValue.function, but no JSValue.closure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants