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

implement long long type #10

Open
marcoscaceres opened this issue Jan 7, 2013 · 3 comments
Open

implement long long type #10

marcoscaceres opened this issue Jan 7, 2013 · 3 comments
Assignees

Comments

@marcoscaceres
Copy link
Contributor

http://www.w3.org/TR/WebIDL/#idl-long-long

@ghost ghost assigned FremyCompany Jan 11, 2013
@marcoscaceres
Copy link
Contributor Author

Implemented LongLong as it's in the spec, but it won't work because the numbers are too big for JS. We need a way to covert them.

@FremyCompany, you are our resident Math guy!:) Can you help?

For reference, Google did it like this:
http://closure-library.googlecode.com/svn/docs/closure_goog_math_long.js.source.html

@FremyCompany
Copy link
Contributor

I'm afraid we're going to use boxing here, like Google did, since you cannot do better.

However, since JavaScript can't send 'long long' values and that you cannot return 'long long' values to JavaScript (you'll be restricted by what a Number can hold), this does not really matter: the LongLong type can only be used inside an API.

We can include support for long long as something optional that uses boxing and rely on Google's implementation (ie: if you want to make a polyfill using long long, then you need to include the Google API for it to work, or you accept to loose precision during the calculations).

What do you think of that?

@marcoscaceres
Copy link
Contributor Author

I think that that is fine. Like you said, there is no use case for long long in JS itself - only for something that would be running boxed (or in C++).

So we should just de-prioritize supporting this altogether for now and maybe just throw an NotSupportedError.

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

No branches or pull requests

2 participants