3 ms·
I've always found 'declarativism' in general to be very hard to understand. I was terrible at maths until I became a programmer and was able to concretely explo
by richardjdare 11y ago
I've always found 'declarativism' in general to be very hard to understand. I was terrible at maths until I became a programmer and was able to concretely explore the mechanics of number using imperative programming languages. For many years, post-high school mathematics was incomprehensible to me and languages like Haskell seemed like absurd contrivances when placed next to the concrete reality of C compilers and CPU clock cycles.
It was only by butting my head against mathematics again and again, and by easing my way into functional programming via Javascript that I began to understand declarative thought, and what it meant to perceive logic in a static picture rather than as the expression of some concrete action. I still don't get it it's foreign to my way of thinking, but I know what it looks like now.
I enjoyed this article a great deal, but my hackles did rise somewhat at the author's assumption that declarativism is somehow closer to human thinking than imperativism. It is more abstract, yes, and maybe more familiar to a natural mathematician, but I do not believe declarativism has a special status with regard to human thought.
I don't think it would be a poor hypothesis to suggest that many people reason using a much softer, more "narrativ-istic" kind of thinking than is represented by mathematics. This kind of thinking is closer to imperative programming which often seems like you are telling a story about how to solve a problem - the details of the computer's memory and CPU being the indispensable forest and woodcutter's axe of the tale.
I think that a lot of the proponents of declarative programming (and functional programming for that matter) are mathematically talented people who are cognitively inclined to understand things in that way - just as the positive features of imperative (and object oriented) languages are similarly attractive and seemingly fundamental, to other kinds of thinkers.
- xamuel 11y agoI'm a mathematician and I'll be the first to say, this "declarative = mathematical" meme is completely inaccurate. If you look at most mathematical theorems and proofs, they are mostly imperative. Take for example the proof there are infinitely many primes. "Assume there are only finitely many primes (assume: imperative). Let them be called p_1,...,p_n (let: imperative). Let q=(p_1...p_n)+1 (let: imperative). Then q is not divisible by any of p_1,...,p_n, so q is prime (this is the only non-imperative line in the proof). Contradiction, discard the assumption and conclude there are infinitely many primes (imperative)." The biggest "non-imperative" feature of mathematics is the way functions are first-class objects. But that's only considered to be "non-imperative" because of a historical fluke, there's no intrinsic reason why "first class functions" = "non-imperative", it's just that the early languages happened to be that way.