Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Ets is built with shared memory, yes, but interaction with your code is as if you were messaging a table process

To me, this is a distinction without difference.

Shared, mutable memory access without some form of synchronization is a bug and is always invalid.

You either hold a lock the entire time you're using a shared value, or you use a lock to take a copy of the value and then go about your business. With the singular exception of atomic values, the value should never change while you have it without you taking an explicit action to update it, and atomics are rarely used outside of either metric tracking or very specialized code. Besides atomics, everything you described about ETS is the same as any shared memory system.



> Shared, mutable memory access without some form of synchronization is a bug and is always invalid.

That doesn't prevent it from being really easy to write, and sometimes very hard to notice in a lot of languages. In BEAM languages, you can, of course, set up similar bugs through the use of other processes (or ETS), but you have to work harder to do it wrong than to do it right.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: