Preferences

cousin_it parent
> I think that’s a consequence of the fact that multiple users can simultaneously edit a sheet.

No, it's not. Built-in functions like SUM recalculate instantly, and custom formatting rules (e.g. "color green if above zero") get applied instantly, even when there are multiple users editing a sheet. Running custom functions and triggers on the server is just a decision they made.


Someone
Sum and custom formatting are idempotent. It doesn’t matter whether that gets run once, twice, or a hundred times.

Arbitrary AppScript isn’t guaranteed to be idempotent. You have to run it only once.

cousin_it OP
This reason doesn't make much sense to me. Let's say I write a non-idempotent custom function. It makes the spreadsheet behave weirdly: recalculating a cell twice leads to a different effect than recalculating it once. Does it matter whether the function runs on the server or the client? No, the spreadsheet will behave weirdly in either case, even with just one user.

Can we make a programming language that will save developers from that? Maybe, but that would be very hard and that's not what Apps Script is trying to do. It already allows non-idempotence, trusting developers to write idempotent code when they need to. So it could run on the client just fine.

This item has no comments currently.