Toots for functionalscript@techhub.social account

Written by Sergey Shandar on 2025-01-11 at 20:34

[#]JavaScript is a weird language; it has #bigint, but it doesn't have a function that returns a number of bits in the bigint. Neither it has #log2 function for the bigints. If you need a workaround for the problem, see the article https://medium.com/@sergeyshandar/improving-the-log2-algorithm-for-bigint-in-javascript-7e5692e7bf0b?sk=9ac18367f61b524704cc8d82707aed3d

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-12-11 at 20:57

Modern ECMAScript WTF: Do you expect that export const myObj = 42 is equal to export default = { myObj: 42 }? Wrong! default is a "special" namespace... #javascript #ecmascript #esm #module

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-30 at 02:05

From today, FunctionalScript source code are ES modules. Published on NPM and JSR. https://github.com/functionalscript/functionalscript #functionalscript #npm #jsr #javascript #ecmascript #esm #module

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-25 at 23:41

Does anyone know how to make a fast log2 function for bigint in JavaScript?

I know that JS VM can do it in almost O(1) because it has information about the size of bigint. My current best algorithm is O(log(n)). The algorithm performs faster than x.toString(2).length and consumes less memory. Do you have any ideas for improvement?

https://github.com/functionalscript/functionalscript/blob/a9a1cd2c1b0f4c025faf2223eb6ff96f48e8374b/types/bigint/module.f.cjs#L65

[#]JavaScript #bigint #log2 #Algorithm

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-20 at 04:05

Just an idea for the future ECMAScript proposal: UTF8 literal. The literal should have the prefix u. For example, u"Hello!". The literal automatically converted into bigint. For example, u"Hello"will be converted into 0x1_6F_6C_6C_65_48n. LSB first, the most significant byte is 1 as a terminal symbol. The===` will work, but ordering (<,>) is not lexicographic. The good thing about this literal is that there is no need to change a JavaScript VM, only its parser. #JavasScript #utf8 #ecmascript

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-19 at 01:33

NaNVM re-architecture plan https://medium.com/@sergeyshandar/nanvm-re-architecture-8097f766ec1c?sk=d14ec1daf73ac5442f12ce20b2bc037a #functionalscript #vm #JavasScript #rust

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-14 at 06:52

I may skip adding Uint8Array and other typed arrays to FunctionalScript because bigint is a good enough representation of a sequence of bits. #javascript #ecmascript #bigint #typedarray

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-13 at 22:21

Now the functionalscript/html module recognizes void elements at run-time: https://github.com/functionalscript/functionalscript/pull/280/files#diff-455482d2c63fb17913906d003fabb67dc33b9e7784882fe887ce0162e8f0248e

[#]javascript #html #FunctionalProgramming

=> More informations about this toot | View the thread

Written by Sergey Shandar on 2024-11-03 at 01:57

I also create art. It helps me think. For example, I draw hash maps: https://raw.githubusercontent.com/sergey-shandar/public/refs/heads/main/notes/hash-map-256.md #hashmap #art

=> More informations about this toot | View the thread

=> This profile with reblog | Go to functionalscript@techhub.social account

Proxy Information
Original URL
gemini://mastogem.picasoft.net/profile/109466412230410577
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
361.359394 milliseconds
Gemini-to-HTML Time
2.508711 milliseconds

This content has been proxied by September (3851b).