Conversation
Notices
-
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 21:42:56 CET Piggo🐽 @ekaitz_zarraga or turn them into integers with some bit magic and hope it doesnt get fucked up by javascript representing everything as float internally -
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 21:45:11 CET Piggo🐽 @deshipu @ekaitz_zarraga yes thats what im saying. but it fakes integers pretty well most of the time -
ɗ𐐩ʃƕρʋ (deshipu@fosstodon.org)'s status on Friday, 03-Mar-2023 21:45:12 CET ɗ𐐩ʃƕρʋ @piggo @ekaitz_zarraga javascript also doesn't have integers...
-
ɗ𐐩ʃƕρʋ (deshipu@fosstodon.org)'s status on Friday, 03-Mar-2023 21:48:47 CET ɗ𐐩ʃƕρʋ @ekaitz_zarraga @piggo they really are an internal implementation detail for the objects, that got exposed
-
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 21:53:40 CET Piggo🐽 @ekaitz_zarraga @deshipu so its a linked hashmap? honestly i just use plain arrays and objects for everything, it's ugly but fast enough for most things -
ɗ𐐩ʃƕρʋ (deshipu@fosstodon.org)'s status on Friday, 03-Mar-2023 21:56:29 CET ɗ𐐩ʃƕρʋ @ekaitz_zarraga @piggo hmm, and you can't have a custom hashing function on your own object?
-
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 21:58:05 CET Piggo🐽 @ekaitz_zarraga @deshipu what i meant is something like
let coord = ((x & 0xFFFF) << 16) | (y & 0xFFFF);
but that's of course for unsigned integers only and so obvious you probably dismissed it already -
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 22:01:34 CET Piggo🐽 @ekaitz_zarraga @deshipu the proper webshit developer solution is to download some Map node_module that does this (and does the shitty JSON hack internally but you don't see it 🙈) -
ɗ𐐩ʃƕρʋ (deshipu@fosstodon.org)'s status on Friday, 03-Mar-2023 22:02:01 CET ɗ𐐩ʃƕρʋ @ekaitz_zarraga @piggo I don't know about JavaScript, but in Python there is a __hash__ magic method, which defaults to object's id, which tells the dicts how to hash the objects of that type. So by default they get hashed by id, which gives you pretty much what you described, but you can change it to only use some values from the object that you choose. There is no problem with foreach, because the dict stores both the keys and the hashes.
-
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 22:04:34 CET Piggo🐽 @ekaitz_zarraga @deshipu is there some didactic reason why you're not using es6 class there? -
Piggo🐽 (piggo@piggo.space)'s status on Friday, 03-Mar-2023 22:07:17 CET Piggo🐽 @ekaitz_zarraga @deshipu here's one more shit falling into your fan
-