by lliwta · 12y ago · 0 comments
1. Macros. And you don't get to weasel, because any non-trivial spreadsheet application contains at least a few.
2. relative references, which are basically heap pointers.
3. simulating for loops/iteration is a fairly common thing in spread-sheet programming.
But also see my edit to the original comment.
As an aside, it's absolutely astounding to me that my original reply is down-voted.
edit: most obvious -> a few
edit2: Could someone please explain what's so offensive about these posts? Is there that much love for spreadsheet programming (last I checked everyone understood the downsides of at-scale spreadsheets and how these problems arise from subtle non-declarative features)? Am I being unintentionally abrasive? Should I post example files and links to empirical studies demonstrating how people commonly program spreadsheets in non-declarative ways?
Not trying to be an asshole, but since you were asking, I'm just saying what I suspect to be a possible reason...
> declarative programming good, Excel bad, hence Excel not declarative programming.
I didn't choose the definition of declarative programming. I'm taking the article's definition as given.
I've no idea why and when it happened, but downvotes now seem to mean "I disagree, but am too lazy to write a comment", instead of "your comment is not fit for this site and/or it damages the quality of current discussion" as it was understood before.
Relative reference declares a dependence relationship. That's part of what declarative programming is.
To use your analogy, it's like writing a lambda calculus interpreter with an FFI, doing everything via the FFI, and calling it declarative.
But macros are only part of the problem.
> That's part of what declarative programming is.
Sorry, I was constraining myself to the definition from the article.
SQL is a good example. You can get the desired output from a variety of queries... some of which might complete an order of magnitude slower than others. At some point you will need to peel back the "what" abstraction and consider the "how" -- what execution plan will the engine make for a given query.
Regardless, it's still a win. Even if it is no longer purely declarative, you still have leverage. i.e. You're expressing the solution concisely and with satisfactory performance, both.
I kind-of agree. The primitives do have many nice properties.
> You're nitpicking on details which equally applies to prolog too.
I strongly disagree.
When escape hatches exist, I think you have to look at how a language/system is commonly used in order to assess whether it has some of these properties or not. Otherwise everything in which a pure function is definable becomes declarative and the phrase becomes rather useless.
Prolog and spreadsheets differ in a rather fundamental, albeit empirical, way: spreadsheet users tend to make pervasive use of the these imperative features.
So there are two alternatives -- spreadsheet programmers are all completely inexperienced and have no idea what's good for them, or there are fundamental limits to the declarative features of the spreadsheet model, beyond which they become imperative.
I think the answer is a bit of both. Spreadsheet users tend to not be trained software engineers, but they aren't idiots and basic programming is not rocket science. None-the-less, lots of spreadsheets end up with pervasive use of imperative features (which causes real problems in terms of maintainability)
So assuming a huge population of users are at least kind-of competent/intelligent, there appear to be fundamental limitations to the basic model, beyond which it can't be used to solve common problems effectively in a declarative way.
Which of course should be interpreted by those who really like spreadsheet programming as a call to arms (education and/or refinements to the model) rather than a categorical criticism...
Spreadsheets are a tool in which one motivated in that direction can do fairly pure, fairly complex, dataflow oriented programming -- but that's not generally what they are used for.