7 ms·
> Just because code is written in an asynchronous style doesn't prevent correctness errors that would not exist with locking. Yes, that's why I referenced pass
by jnbiche 7y ago
> Just because code is written in an asynchronous style doesn't prevent correctness errors that would not exist with locking.
Yes, that's why I referenced passing around a reference to an immutable data structure, which is fairly common in JS.
- vore 7y agoHow will you update the bank account with an immutable data structure? You need to mutate the balance somewhere.
- jnbiche 7y agoWell, in practice you're presumably using a database, which has transactions in the API you're using. But to answer your question, in functional programming (also frequently ReactJS, if you use libraries like Redux), you don't mutate the data structure. You create a new data structure based off the old one. Am I misunderstanding your question? Just because you use an immutable data structure doesn't mean it can't be updated.
- dboreham 7y agoDatabase written in not(Javascript) of course, since it has to work and handle concurrency properly.
- jnbiche 7y agoYes, of course. Why would you build a database in JS? And does gmail not work well for you? Most of us are only using JavaScript because that's the only way to build browser applications (or compile-to-JS languages, which still require an understanding of JS or you'll run into problems). In any case, I don't particularly like JS, so your dig fell short. But JS is necessary for many of us.
- zo1 7y ago> "Most of us are only using JavaScript because that's the only way to build browser applications (or compile-to-JS languages, which still require an understanding of JS or you'll run into problems)." The javascript apocalypse is inevitable, we're just yet to reach the tipping point where this hard-requirement to use JS for web/browser applications is no longer there.