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

WTF is "Declarative" and how XSLT is declarative?

XSLT is functional!

XSLT/XPath can also be statically typed: XSLT compilers happily infer types of all expressions in their XPath.



Functional is a type of declarative language.

http://en.wikipedia.org/wiki/Declarative_programming


In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow.

XSLT does describe control flow pretty explicitly; most functional languages I know, too. In other hand, languages like Java allow the VM to shuffle their control flow considerably.

I vote for dropping "declarative". Call query languages query languages, functional functional.


Isn't Prolog declarative?


It IS. Declarative != Functional, despite the huge overlap.


Prolog is a logic programming language and as far as I know logic programming is a subset of declarative programming.


Prolog has a logic core but also some imperative features. Programmes can be specified in a purely declarative manner.


Yes, I was discarding the imperative features.

It always struck me as odd how purists adore Prolog for its conceptual clarity, but then as soon as you want to write anything nontrivial in it, they come and tell you to place "cuts" everywhere, exposing the imperative execution order throughout the program. IMHO this is evidence of Prolog being a failure.


Prolog - maybe. XSLT, ML, whatever - are not.




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

Search: