Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The thing that distinguishes genuine "declarative" or "goal-based" programming is that the order of expressions in the source language doesn't affect the order of execution[0].

On the other hand, I see the level of abstraction as (roughly) the average number of machine instructions executed for every statement or expression in the source language.

With these two definitions, its clear that while "declarative" languages will almost necessarily be at a high-level of abstraction, you can also have languages that operate at a high-level of abstraction without being declarative.

caveat: the original link wouldn't load for me, so I don't know if my response makes sense in light of the original article.

[0]a more technically correct definition is provided by David Barbour https://awelonblue.wordpress.com/2012/01/12/defining-declara...



You can make C++ generate a ton of code from template abuse. It doesn't make it a higher level of abstraction. It can be perfectly imperative code.


My point is that abstractness and imperativeness are orthogonal. For instance, Bash and C are both imperative in that they both structure programs as a sequence of commands. However; Bash operates at a much higher level of abstraction because each command "does more work" (by which I mean roughly translates to more machine instructions).

Prolog is both abstract and declarative. Prolog programs are structured as a set of propositions (i.e. declarations). The difference between Prolog and Bash is greater than the difference between Bash and C, because the nature of Prolog implies a fundamentally different way of designing programs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: