Вопрос

I've been researching declarative languages, and it seems like declarative is just an umbrella term for both logic and functional languages. Or am I wrong? Are there any general-purpose declarative programming languages that can't be classified as either functional or logic(al), and simply "declarative"?

Это было полезно?

Решение

A declarative language requires you to code for what you want to happen rather than in an imperative language where you code how the computation should be done.

In general this means that a declarative language does not allow for side-effects, whereas imperative languages almost require coding with side-effects.

In order for general-purpose languages to be, well, general-purpose they require the ability to code side-effects. It thus make them hard to be declarative.

Languages like F# have a strong basis in functional programming, but have any constructs to allow for OO programming and side-effects. This makes F# a general purpose language but does so by allowing imperative style coding to be mixed in with declarative coding.

Although not entirely impossible, I would suspect that there are no "purely declarative" general purpose programming languages just simply by definition.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top