[your-first-webgpu-app] Reserved keyword `in` used in example code
- On the following page: https://codelabs.developers.google.com/your-first-webgpu-app#6
-
Under the following section:
Use the ping-pong buffer pattern
You give an example of "ping-pong state" for the reader to try (but not to copy into the project). The reader may want to copy/paste this example in order to test it out, only to hit an execution error. This is because one of the arguments is named in, which is a reserved keyword.
My proposal:
function simulate(incoming = [], outgoing = []) {
outgoing[0] = 0;
for (let i = 1; i < incoming.length; ++i) {
outgoing[i] = incoming[i-1];
}
}
Additionally, there is a very minor issue on the previous page: https://codelabs.developers.google.com/your-first-webgpu-app#5
There appear to be some rogue * characters. If you search for Another alternative, you should find it:
Screenshot
Thank you really much @beefchimi!
incoming = [], outgoing = [] would work. I also like inArray, outArray.
Thanks for catching the * characters issue as well!
I'll let you know when the codelab is updated.
This issue is now fixed. See https://codelabs.developers.google.com/your-first-webgpu-app?hl=en#5 and https://codelabs.developers.google.com/your-first-webgpu-app?hl=en#6