If you were to invent a language to be used in spreadsheets today, what would it look like?
Would you just jump on the JavaScript bandwagon?
Google Docs clones the Excel formula language for use in cells but allows you to write
extensions/macros (where you would use VBA) in Google Apps Script but what is it
really? It looks a lot like JavaScript. The documentation totally
sucks, it lives in the Google Apps Script IDE, the debugging is
terrible. It can't easily be shared or put on github and it's hard to test.
Why not have a single language for the cells and for extensions? I'm thinking real JavaScript would be interesting, as in is being able to import
external scripts and exporting their globals into the spreadsheet's namespace then being able to
set a cell to apply the function and display the output of that
function.
So you could set the value of a cell to `=function(i){Math.pow(i,2)}(A2)` this would
apply JavaScript's `Math.pow(_,2)` to the value of the cell `A2` or you could let imported functions work directly on the spreadsheet cells and do something like `=Math.pow(A2,2)`
This doesn't solve the problem of JavaScript being a terrible programming language and after re-reading the above,
is asking users to write a closure around multiple-argument functions crazy, is polluting the spreadsheet namespace with external functions too crazy? What if a third party JavaScript lib has a function called A2, or even SUM which conflicted with the builtins Perhaps a
stack-based programming language would be more appropriate,
especially when you start trying to do operations on ranges (lists).
The first thing that comes to mind is Forth but a more modern
alternative that plays well with JavaScript is Daimio http://daimio.org/.
Would you just jump on the JavaScript bandwagon?
Google Docs clones the Excel formula language for use in cells but allows you to write extensions/macros (where you would use VBA) in Google Apps Script but what is it really? It looks a lot like JavaScript. The documentation totally sucks, it lives in the Google Apps Script IDE, the debugging is terrible. It can't easily be shared or put on github and it's hard to test.
Why not have a single language for the cells and for extensions? I'm thinking real JavaScript would be interesting, as in is being able to import external scripts and exporting their globals into the spreadsheet's namespace then being able to set a cell to apply the function and display the output of that function.
So you could set the value of a cell to `=function(i){Math.pow(i,2)}(A2)` this would apply JavaScript's `Math.pow(_,2)` to the value of the cell `A2` or you could let imported functions work directly on the spreadsheet cells and do something like `=Math.pow(A2,2)`
This doesn't solve the problem of JavaScript being a terrible programming language and after re-reading the above, is asking users to write a closure around multiple-argument functions crazy, is polluting the spreadsheet namespace with external functions too crazy? What if a third party JavaScript lib has a function called A2, or even SUM which conflicted with the builtins Perhaps a stack-based programming language would be more appropriate, especially when you start trying to do operations on ranges (lists).
The first thing that comes to mind is Forth but a more modern alternative that plays well with JavaScript is Daimio http://daimio.org/.