Any migration plans for using theTypescript 5.2 "using" clause for framework Disposing

Saw this, (1) JLarky on Twitter: “Why are we adding borrow checking to JavaScript?” / Twitter.

Wonder if this would make it easier for handling disposal. Am also looking into it for my own stuff.

i thought about it a few weeks ago.
The using keyword is meant as a way to release resources when they are no longer needed. It’s mainly used inside a loop - take the resource, use it, release it. But in babylon the resources (which is a bit abstracted, because why is a Camera a resource?) are disposed outside of a specific loop, only when the scene is disposed.

Now, it is true that we could wrap the functionality correctly, and use the resources as suggested there, but this is not Babylon’s paradigm.

As a developer you will be able to use it for sure. In the framework? I am not sure.

I guess there are certain areas in the framework that might benefit from the new keyword, but not without changing the architecture.

If we are talking about new js features, I personally believe this - GitHub - tc39/proposal-structs: JavaScript Structs: Fixed Layout Objects will benefit us a lot :-). especially the shared struct

1 Like

Ok. I am coding more at the engine / multi-scene level, & need to be looking pretty closely when the scenes change over, especially for immersive mode switches. Think I’ll just stick to controlling order of things.


I can see how having at least some parallel processing patterns would be quite helpful. The Rust / WASM route for real hotspots A.K.A make the main thread faster, might be the best thing to be done for a while.

That Repo has not made meaning changes in 2+ years. Is that good?