Bob, a long-time programmer, wrote us today and asked about the future of Calcapp when considered as a programming language. Bob is doing some advanced things with the apps he creates using Calcapp, including storing large amounts of text in hidden fields and using our text functions to extract it. Will Calcapp become more like a regular programming language in the future? Here’s our co-founder David’s (technical) response:
Calcapp is and isn’t a programming language, depending on how you look at it. If you believe our marketing, using Calcapp means that you can create apps “with no programming involved.” That’s there to signal that traditional programming is not part of the experience (which, to most people, seems esoteric and hard).
Currently, I’d say that Calcapp is a pure functional, reactive programming language. All functions are pure, meaning that they don’t have any side-effects. That makes it functional. It’s reactive because everything updates automatically. That’s the classic spreadsheet programming model which is very intuitive to most people.
So Calcapp isn’t traditional in the sense that its model isn’t imperative (where you specify what instructions to execute, one after another, at a high level or at a low level). We will most likely introduce imperative elements, though. Here’s a letter I wrote to a user on this very subject.
Essentially, we’d like to allow functions that do have side-effects (like sending an e-mail) in very specific contexts, notably when you’re pressing a button. Buttons would be allowed to run “action formulas,” which would have access to special “action functions” with side-effects. (A computer scientist would call these functions impure functions, but we’ll probably go with easier terminology.) That will allow you to, say, reset two fields if, and only if, a field is greater than two:
IF(Field1 > 2, RESET(Field2.Id); RESET(Field3.Id)). (The semicolon would be a new operator which would return the value of its second operand but evaluate both.)
I would also like to add an impure SET function, which would allow you to change a value:
SET(Field1.Id, Field1 * 2). Pressing a button would then enable you to change values or perform calculations. It would also be nice to have access to a function returning a field value where you can determine the field name through a formula.
Action formulas are akin to traditional, imperative programming in a sense, but I don’t think we’ll ever introduce loops or the other constructs that people generally have a hard time with. Calcapp is, ultimately, meant to be easy to use if you’re used to spreadsheets (not counting Excel’s VBA). We want to build the most powerful application platform we can, while still mostly using a pure functional, reactive model, because people intuitively understand that model.