I think a lot about how Battlefield 1's menus were written in JavaScript so they could have their web developers build a videogame UI

The actually used React to make a game UI. Why.

The PS4 doesn't allow just-in-time compilation so you don't get the performance a modern javascript engine normally guarantees so on what planet is this a good idea

@wallhackio The JavaScript Planet, a dystopian world where JavaScript is the only programming language ever invented

@wallhackio But you don't love writing a computer game in JavaScript! (Or at least, I hope you don't love that...)

@vaporeon_ depends! corru.observer/ was written entirely in JavaScript and it is cool as shit

@wallhackio How do I deallocate memory / destroy an object in JavaScript? So that I can delete this?

@wallhackio Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo :blobcat_notlikethis:

And in standard JavaScript? No NPM?

@wallhackio But can you do any memory management in JavaScript?

@aescling @vaporeon_

const deleteThis = () => {
const temp = { _this: this };
delete temp._this;
};

@aescling @vaporeon_ this will NOT do what it's being promised to do, this is a joke

@vaporeon_ @aescling it will create an object with a single property named _this that has the value of whatever this was where the arrow function was declared

and then it will delete that property from the object

@wallhackio @aescling So creating the object initializes _this with a copy of the value of this, and only that copy gets deleted? :psyduck:

@wallhackio @aescling I did! I have a lot of trouble with the concept of references that are not pointers, but as far as I understood, it's just telling the compiler a different name for the same variable? Sort of like EQUIVALENCE in FORTRAN?

Show newer

@vaporeon_ @wallhackio

const o = { k: 1 };

function changeObj(o) {
o.k = 2
};

changeObj(o);
console.log(o); // { k: 2 }

@aescling @wallhackio LOL, is that because the pointer is a constant, but the contents of the object are not? In C terms, what happens here is this, right?

changeObj(struct object *o) {
o->k = 2;
}
main() {
const struct object *o = new_object(1);
changeObj(o);
printf("k: %d\n", o->k);
}
Show newer
Show newer

javascript wonkery 

@wallhackio @vaporeon_ fur the record, the following alternative implementation is subtly but meaningfully diffurent:

const deleteThis = function() {
const temp = { _this: this };
delete temp._this;
};

arrow functions and functions defined with the function keyword have intentionally diffurent rules about resolving this

@aescling @wallhackio @monorail Ms. Glaceon, please, we need that emoji
Maybe call it blobcat_eyeroll, for consistency

@monorail @vaporeon_ @aescling it wasn't a reference to anything, you were just there and I felt like saying something nice

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.