Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there purely declarative, general purpose programming languages?

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"?

like image 646
Matt Avatar asked Sep 17 '12 01:09

Matt


1 Answers

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.

like image 157
Enigmativity Avatar answered Sep 18 '22 23:09

Enigmativity