Do away with $ prefix for sheet refs?
chrispsn opened this issue · 1 comments
When the getters are added to the sheet object, can it instead add the getter to the module object (if such a beast exists)? It can add to the global object, but that'll pollute the namespace:
const DATA = [["what", [1,1], () => 1], ["the", [2,1], () => what]];
// https://mobile.twitter.com/WebReflection/status/269578376833024000
const SHEET = Function('return this')();
for (let [k, _, v] of DATA) {
Object.defineProperty(SHEET, k, {
get: () => {delete SHEET[k]; SHEET[k]=v(); return SHEET[k]},
configurable: true
})
}
Mesh files are now run in Web Workers, which get their own global namespace.
But conceivably you could drop the prefix even using a module namespace; when you make a cell that depends on another cell, you'd need to figure out the implict inputs from the return statement of the function (AST analysis?), and add those as arguments to the function. When calculating the cell, you'd need to get the arguments' names from the function, use them to get the corresponding values from the 'sheet' object, and pass the values to the function.