2
$\begingroup$

I'm studying a declarative programming language (Prolog) and in thinking about how certain things are programmed at a low level, a question came to me:

are programming languages ultimately procedural ?

$\endgroup$
  • 1
    $\begingroup$ IMO that question makes no sense to ask. How the language is implemented does not affect what it is. $\endgroup$ – harold Mar 7 '18 at 13:10
  • 2
    $\begingroup$ What about the opposite direction? You can implement a Python interpreter in Prolog, for instance -- would you say that Python is "ultimately declarative/logic" because of that? $\endgroup$ – chi Mar 7 '18 at 13:45
  • $\begingroup$ The programming languages of computer processors (called "Assembly" or "machine code") are imperative. "Imperative" is what you probably meant by "procedural". Assembly does not have procedures actually. Hence if we want to run a program, we need to translate it into an imperative language. This translation belongs to an implementation of the language. A programming language is defined by its semantics, not by its implementation. There may be many implementations of the same language. $\endgroup$ – beroal Mar 10 '18 at 12:56
4
$\begingroup$

I imagine that by "procedural" you mean languages whose statements refer to changes of state in one ore more objects, but these references are implicit, not explicit (they follow a fixed pattern, for instance, the state change made by the execution of a statement is delivered to the next, resembling a procedure).

You may be referring to the fact that our computers, at a low level of abstraction, are usually state machines - so to speak - so all programming languages would have to be procedural languages disguised as something else.

This has happened for technical and economical reasons, it's not a theoretical imperative. It doesn't have to be that way. Inside your head there is a computational device that isn't like that, and we've been experimenting with all kinds of different models for low level implementation of general-purpose computers for decades. It is not unlikely that, at some point, one of these alternative models becomes commercially viable.

$\endgroup$
4
$\begingroup$
  1. Existing hardware is "procedural". Therefore, whatever machines do, it is always "procedural" at the very low level. However, there is nothing mathematically fundamental about procedural computing. There are many forms of computing (procedural, functional, logic programming) and they can all simulate each other.

  2. Furthermore, a programming language may have a definition of how it executes that does not "translate" or "compile" to anything. If such a language is functional, then we have a functional programming language that is not "ultimately procedural" because its execution rules are explained without refrence to anything procedural (Note: the execution rules themselves are given as an inductively generated relation, so they are a mathematical object and it makes no sense to ask "are the rules procedural?" It makes sense to ask how the rules should be implemented on existing hardware, goto 1.)

$\endgroup$
  • $\begingroup$ Most existing hardware. There are still LISP machines kicking around in labs, for example. $\endgroup$ – Peter Taylor Mar 7 '18 at 17:03
  • $\begingroup$ Ooo, it would be cool to have one of those. How much do they weigh? $\endgroup$ – Andrej Bauer Mar 7 '18 at 19:14
  • $\begingroup$ My director of studies at university had one which was about the size of a large CRT, so probably only weighed a few kilograms. The illustration on the Wikipedia page shows one which looks more like 50kg. $\endgroup$ – Peter Taylor Mar 7 '18 at 22:18
  • $\begingroup$ Speaking of non-procedural hardware, I vaguely recall having to solve some differential equations using an electronic analog computer in the late 80ies. $\endgroup$ – Kai Mar 8 '18 at 3:02
  • $\begingroup$ I vaguely remember the late 80’s. $\endgroup$ – Andrej Bauer Mar 8 '18 at 16:50
-3
$\begingroup$

No. not every programming language is procedural at the end. as procedural languages follow the pattern as the statements are typed whereas Non procedural languages keeps jumping to different statements and methods... take a look here too

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.