Sprints: [P1] Document BigInt

Created on 8 Feb 2019  Â·  33Comments  Â·  Source: mdn/sprints

Cross-filed from https://bugzilla.mozilla.org/show_bug.cgi?id=1476965.

See also https://trello.com/c/toqiqtQ1/17-bigint-fx-67 for the content roadmap Trello card detailing the bugs that need to be ddc'ed one this is done.

Florian's recommendations:

I think we should document this sooner rather than later. I'm adding my brain dump on what I think needs to be done. There might be more work involved here, but this is a start.

BigInt is a new primitive type and this needs to be added to a few places (with notes on type conversation)

BigInt should be mentioned/referenced from relevant Number docs

BigInt comes with a new numeric literal (n)

BigInt and typeof

BigInt API:

BigInt TypedArray API:

BigInt and interaction with other parts of JS (add examples)

All new reference pages need compat data and interactive examples, see

Firefox68

All 33 comments

@sarahgp wrote https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt

This needs reviewing. @Elchi3 can you give her some feedback and help her with future work here? Provided she still wants to contribute further, of coursde ;-)

Yes, I am still interested in contributing and I am open to feedback. I've also been emailing with @iulia-codes about contributing.

My next plan is to take on the Updates starting from the top, but if other people want to hop in (I have limited time), I am totally glad for that, too.

Hey, thanks for re-filing this on GitHub! I've updated the description to use checklists.

I've glanced over the two pages that were created so far and they look excellent!
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/prototype

I'm happy to review more and let me know if there are questions with the items on the to-do list above.

Hi all, so I've updated the main https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray but I am missing permissions to create new page. Can the page placeholders already be created ? https://developer.mozilla.org/en-US/docs/new?slug=BigInt64Array&parent=5612 and https://developer.mozilla.org/en-US/docs/new?slug=BigUint64Array&parent=5612

I will work on these next.

@iulia-codes I am happy to give you page creation permissions. What's you MDN username?

I am also happy to create the placeholders for you, but it looks like when you use the jsxref macro call to create a reference to a new page, it is creating them under /JavaScript/Reference, whereas it should be creating them under /JavaScript/Reference/Global_Objects, e.g.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array

So ideally we should create them as children of Global_Objects, e.g. by going to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects and using the "New sub-article" option in the gear menu.

Hi @chrisdavidmills, my username is iulia on MDN

Good thing to know about the hierarchy of the pages & thanks for creating the two new pages :)

Hi @chrisdavidmills, my username is iulia on MDN

OK, cool. I've given you page creation permissions.

Good thing to know about the hierarchy of the pages

Yeah, I had to do a bit of digging here. I asked around, and it looks like the jsxref macro has a couple of bugs in terms of where new pages a created, if you use it to create links to new/non-existent pages.

thanks for creating the two new pages :)

You are welcome. Let me know if you need any more help.

@iulia-codes Hi there! I just wanted to do a quick check in about the two pages I created for you to fill in. Do you think you'll have time to do them soon? If not, don't worry about it — we can just delete them again until you are ready.

Hey @chrisdavidmills, I noticed the pages are gone, but that's okay, as I've continued updating on the already existing pages. I have planned to update the two new pages that you created by the end of May.

Great work on all of those, @iulia-codes. The new content you wrote looks very good to me. Would it make sense to also add context to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_Types#Literals ?

Hey @chrisdavidmills, I noticed the pages are gone, but that's okay, as I've continued updating on the already existing pages. I have planned to update the two new pages that you created by the end of May.

Hi @iulia-codes; thanks for all the work on this! If you are ready to start working on those two new pages, I can always reinstate them again. Would you like me to do so?

Hi @chrisdavidmills yes, I can finish it this weekend and then maybe have it up for review.

Definitely @littledan will add a reference there as well.

@iulia-codes ok, cool!

I have reinstated the following pages, so you can now edit them and fill them in:

As always, let me know if you need any help. I'll check my mail a couple of times over the weekend, just in case.

Just a heads up, at the moment the BigInt page itself says:

The following operators may be used with BigInts (or object-wrapped BigInts): +, *, -, **, %.

Without making any mention of bitwise operators, which do appear to be supported.

BigInt typed array API

I worked on the BigInt typed array API part of this as it seems like I wouldn't collide with anyone. Here's things to look at and to maybe review, if you're interested.

The BigInt typed array additions are now listed on relevant pages:

New reference pages have been created:

To make the sidebar menu as useful as for the other typed arrays some hacks are needed:

Browser compat data updates are in this PR (assumes same compat as general BigInt availability)

Interactive sample updates for bigint typed arrays:

Questions:

@chrisdavidmills Could you review the docs that I've listed in the last four comments here?

@Elchi3 Sure. Might take me a few days to dig myself out of this current hole, but I should get to them by the end of the week ;-)

@Elchi3 OK, so I've reviewed all the stuff on https://github.com/mdn/sprints/issues/1002#issuecomment-499090849

The pages all look great and make sense. I just did a bit of light copy editing really.

You had a question here:

A contributor updated following reference page and added some code. This can now use getBigUint64, right?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView#64-bit_Integer_Values

I'm not an expert, but yeah, looks like it.

Thanks Chris! It looks like another contributor added a BigInt version of that code in the meantime already. I've just looked that over and removed "works only in Chrome" which isn't true anymore :)

OK, I've also now reviewed everything at https://github.com/mdn/sprints/issues/1002#issuecomment-499428855

Again, all reads really well. Just a few minor bits of copy editing to do.

Thanks Chris! It looks like another contributor added a BigInt version of that code in the meantime already. I've just looked that over and removed "works only in Chrome" which isn't true anymore :)

OK, great!

Just a heads up, at the moment the BigInt page itself says:

The following operators may be used with BigInts (or object-wrapped BigInts): +, *, -, **, %.

Without making any mention of bitwise operators, which do appear to be supported.

Bump

I've added "Bitwise operators are supported as well, except >>> (zero-fill right shift) as all BigInts are signed. Also unsupported is the unary + in order to not break asm.js."

I've now reviewed everything at https://github.com/mdn/sprints/issues/1002#issuecomment-503638322. All looks fine, just made a few really minor copy edits.

OK, everything at https://github.com/mdn/sprints/issues/1002#issuecomment-511847776 now reviewed too! Only a few copy edits.

I haven't mentioned on every Math method that it doesn't work with BigInt. Should I do that?

Is it just all Math methods? In which case, you already basically say that, so I think we're OK.

Yeah, it is all of them. Thank you a lot for all your reviews! :+1:

I'm going to close this. Thanks everyone who helped on this! If there is follow-up work on BigInt, please file a new issue and cc me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bershanskiy picture bershanskiy  Â·  4Comments

mattiapontonio picture mattiapontonio  Â·  5Comments

EduardoPazz picture EduardoPazz  Â·  3Comments

Elchi3 picture Elchi3  Â·  8Comments

arturjanc picture arturjanc  Â·  5Comments