WebReflection / coincident

An Atomics based Proxy to simplify, and synchronize, Worker related tasks.
MIT License
203 stars 3 forks source link

Maybe a bug: [ERROR] Cannot assign to "transfer" because it is a constant #51

Closed MRYingLEE closed 1 month ago

MRYingLEE commented 1 month ago

I am trying to use coincident, but I met a compiling error: [ERROR] Cannot assign to "transfer" because it is a constant at https://github.com/WebReflection/coincident/blob/c3023460f15b87335e5e4affa9659a2caa93b4b7/src/shared.js#L82C1-L84C43

  const transfer = [];
  if (buffers.has(args.at(-1) || transfer))
    buffers.delete(transfer = args.pop());

My target environment is ES2022.

Please check.

WebReflection commented 1 month ago

@MRYingLEE that's because I am an idiot ... I had tests in place but clearly this one has been lost ... apologies for the obvious issue there, I have updated the library.

WebReflection commented 1 month ago

hah ... found old tests, I'll try to bring some of them back https://github.com/WebReflection/coincident/commit/81cd6a19f6b3b9b77842c3532f4e16571834369c#diff-f0fc357b5659af54404f6b5c1b20daf4239833f964de95bc9d713edaf5987524

WebReflection commented 1 month ago

@MRYingLEE you can find the transfer test code in here, updated to reflect latest coincident signature and features: https://github.com/WebReflection/coincident/commit/d58edb9ab8ba6800fa8fb05de35cd59c0618240b

MRYingLEE commented 1 month ago

After upgrading to the latest version, the compiling error was gone.

Thank you for your prompt response.

BTW, coincident is an amazing package. It brings unbelievable possibilities to web coding.

WebReflection commented 1 month ago

Thank you for your kind words ... coincdent, among everything else I've done to date, is likely on top of my list of biggest achievement around Web standards and I am happy to learn people are very happy about it, your comment adds to that feeling "this is actually a wonderful idea and a game-changer".

Stuff that can be built around is unimaginable, see workerful as example, you can drive both the main thread and the server through a never blocking worker behind the scene. In any IoT system with at least 4 cores that is something extremely interesting to explore too.