| 17:06 | <snek> | i understand that it is proposed to require an unsafe scope to access shared values, but what does unsafe actually mean? like what is the model we are using to categorize things as safe or unsafe. and i guess in particular i'm curious if things we categorize as unsafe really justify the syntax. in rust (and c# i think?), unsafe marks a place where you can actually violate some fundamental model of the language, which i'm hoping you cannot do inside a js unsafe block? |
| 19:11 | <rbuckton> | My impression from Mark's previous comments is that's exactly what this is. Single-threaded, exclusive memory access is the fundamental model of JS (SAB aside). unsafe in this context is about JS code accessing data structures held in shared memory. |
| 19:13 | <snek> | you're saying that inside unsafe you can put the js vm into a state that prevents it from continuing to evaluate javascript in the way that it expects? |
| 19:15 | <rbuckton> | While I don't imagine we'd ever add much else to unsafe in JS (e.g., pointers), we could if necessary. |
| 19:16 | <rbuckton> | you're saying that inside unsafe you can put the js vm into a state that prevents it from continuing to evaluate javascript in the way that it expects? Atomics.wait |
| 19:17 | <snek> | but SAB has a memory model that is defined for unsyncronized accesses. |
| 19:19 | <rbuckton> | But it can't easily be used for data structures, so it's adoption is quite low. Shared Structs will be far easier to adopt, and thus users are more likely to run afoul of shared memory issues |
| 19:21 | <snek> | are you saying that the behavior will be undefined? |
| 19:21 | <snek> | i feel like mark, and all implementations, would object to that |
| 19:23 | <rbuckton> | No, not undefined. |
| 19:26 | <rbuckton> | I'm not clear if your concern is the choice of keyword, or the need for any syntax at all. I'll happily entertain other keywords, but it seems like Mark is quite satisfied with there being a syntax with the semantic proposed as addressing his concern. |
| 19:27 | <snek> | sorry for the confusion, to rephrase... my question was "what does unsafe mean" and then i tacked on an opinion after that which was "if unsafe is just marking some particular way of creating logic bugs i'm not sure its worth it" |