docs(design): record the JS Int64 representation and the browser capability table #418
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/417-js-int64-browser-capabilities"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #417
Step 1 of #62: records the 64-bit
Intrepresentation in JavaScript and the browser capability split indocs/design/JAVASCRIPT-AND-PHP.md, and moves open questions 1 and 3 from section 3 into section 2.What changes
Intin JavaScript: a canonical hybrid, anumberwithin 2^53 - 1 and abigintoutside, never abigintinside. Rules for+ - * / %, the bit operators and the panics (same panic as the C and VM back ends). The boundary rule: JS into TorbScript accepts safe-integernumbers or in-rangebigints, TorbScript into JS gives anumberor throws aRangeError; nothing is truncated.Int32and smaller: one sentence. Four options compared on exactness, panic semantics, speed and.d.tsinterop.std/onmain(and the pure rest in one row), browser column real / simulation / compile error with a line of reasoning each. The PHP column is not added: it follows #62.compiler/src/project/capability.trbis already the browser table of the playground), and theROADMAP.mdmilestone 9 line "the three open questions" now says one.Notes for the reviewer
Int, and the loop does not run builds in its own exec, so this is a Node micro benchmark of a few seconds on one pinned core of a loaded shared host. The record states that, claims only ratios above 1.5, and puts the program in the record so #63 can run it again on the forge's runners.capability.trbon purpose and say so:std/dns(pure, so real) andstd/sandbox/std/machine(compile error for a JavaScript program, real in the playground that hosts the VM). #65 aligns the code.Checks
skills/.tools/check-commits.sh origin/main HEADandpdisc.py checkare clean locally; the docs and commit gates run in forge CI.Approved at
119cd8f. Checklist:bigint, 1.9-2.4x vs the pair, ~27 ns/add on the slow path, 4-7x) and they match; the 2^53 range test argument for+ - *holds. OK.main: everystd/package is covered (named rows plus the "every other" row), thecapabilityOfcapability names matcharchive.trb, the claims aboutstd/os/src/browser/(Unsupported set, pid,/tmp) match the code, and the two intentional differences fromcapability.trb(std/dns,std/sandbox/std/machine) are stated and handed to #65. OK.JAVASCRIPT-AND-PHP.mdplus the oneROADMAP.mdline that would otherwise be false; section 3 keeps only the PHP question pointing to #62; PHP column not added. No seed, code, or syntax change. OK.docs(design): .... Docs: frontmatter-free design record, pdisc green.Non-blocking (optional follow-ups, e.g. with #63):
UInt64/UInt32values in 2^31..2^32-1, where JS|,&,^yield a signed int32; say "fit int32" or add>>> 0for unsigned types.Eis described as "the way Dart on the web treats anint"; Dart does not panic at 2^53 (it loses precision), so "a checked variant of the approach" would be more exact.std/osrow lists theUnsupportedoperations but notprocessorsand process resources, which also fail inbrowser/process.trb.