Proxies may be a cleaner way to handle our threading solution - rather than passing a string name for the function, getting an object that's a proxy with those properties on it would be neat.
Our threading solution also needs some sort of way to handle transferable objects.
Describe the solution you'd like to see
Option 1 (Transferable Wrapper)
This is how threads.js handles this. If you want to transfer an object, you can wrap it in a Transfer() call - this call and how it works should be opaque.
function mySystem(thread: Thread<T>) {
thread.myFunc(Thread.transfer(someTransferableObject));
}
For implementation, this could either be a wrapper that must be unwrapped by the proxy handler, or simply push a value into a local array.
Option 2 (Transferable Argument)
Add a final argument that accepts transferable objects.
function mySystem(thread: Thread<T>) {
thread.myFunc(someTransferableObject, [someTransferableObject]);
}
Not sure how to differentiate between normal arguments and transfers in this case, though
Describe the problem this feature solves
Proxies may be a cleaner way to handle our threading solution - rather than passing a string name for the function, getting an object that's a proxy with those properties on it would be neat.
Our threading solution also needs some sort of way to handle transferable objects.
Describe the solution you'd like to see
Option 1 (Transferable Wrapper)
This is how threads.js handles this. If you want to transfer an object, you can wrap it in a
Transfer()
call - this call and how it works should be opaque.For implementation, this could either be a wrapper that must be unwrapped by the proxy handler, or simply push a value into a local array.
Option 2 (Transferable Argument)
Add a final argument that accepts transferable objects.
Not sure how to differentiate between normal arguments and transfers in this case, though