3 ms·
> All runtimes but MSIE (unless they've added it in IE11) already implement `const`, and it's standardized in ES6. const implemented currently is very weird th
by mraleph 13y ago
> All runtimes but MSIE (unless they've added it in IE11) already implement `const`, and it's standardized in ES6.
const implemented currently is very weird thing. It's more or less a read only variable, which silently ignores updates
var i = 0;
for (var j = 0; j < 10; j++) {
const C = i++;
}
// i == 10, C == 0 here
This is not something one would expect of constants honestly.
> You mean, something like ES6's yield?
yield is shallow, caller must be ready to cope with yielding explicitly, so it's not really a good replacement to proper
coroutines that can pause arbitrary deep stacks.
- masklinn 13y ago> yield is shallow, caller must be ready to cope with yielding explicitly TFA invokes C#'s `await` which is also cooperative and "shallow". Granted in C# there are APIs available for a synchronous function to "block on" an asynchronous one, but aside from that it's equivalent (the limitations are those of the underlying platforms, core.async loses the same features when doing from Clojure/JVM to ClojureScript/JS). > so it's not really a good replacement to proper coroutines that can pause arbitrary deep stacks. I agree, but I foremost went with the examples of "doing it better" which TFA provided, and TFA used `await` (if he'd used gevent or Erlang, I'd have been hosed)