Talk:Introduction to Programming Languages

Objection
I strongly object having Java as an example of the imperative paradigm. --Panic (discuss • contribs) 18:14, 28 May 2012 (UTC)
 * It might be helpful for you to explain your reasoning, given that others might disagree. The authors of the Wikipedia articles on Imperative programming and Java for example. Recent Runes (discuss • contribs) 18:46, 28 May 2012 (UTC)
 * Well lets firs, wait to see if anyone cares to defend the position. Java is not an imperative language even if it can be argued that some parts are done imperatively I would like to understand how the editor sees it and where he draws the line.
 * I don not see anything in Imperative programming that supports Java being an imperative language nor in the Java article itself it clearly is indicated as a OOP language (as it should) of course that all languages derive from the imperative paradigm (except the rare ones that are visually driven). --Panic (discuss • contribs) 19:09, 28 May 2012 (UTC)
 * Well, both the Wikipedia articles simply state that Java is an imperative language even if they don't go to great lengths justifying the point. The contrast here is between imperative and declarative languages broadly speaking. The presence of object orientation is an independent factor that can occur in imperative languages like Ada, C++ and PL/I just as well as in languages like Lisp or Smalltalk. Surely you would not argue that Java is a declarative language? Recent Runes (discuss • contribs) 20:11, 28 May 2012 (UTC)
 * Of course not. As is in C++ or C, but due to the interconnection of paradigms one must be (or at least attempt) to be clear on the examples and on the used interpretation. That is why I object to Java being used as an example of the imperative paradigm. I could admit that Java uses the imperative paradigm in some parts like as you state in the declarative sections but that requires to relax the concept extremely far, so far that it becomes unproductive as a learning tool.  --Panic (discuss • contribs) 20:22, 28 May 2012 (UTC)
 * Java is an imperative programming language: Java programs do have a state, are built around commands, and algorithms in Java do instruct the computer to follow a set of orders. This said, Java is an Object Oriented language. This concept is orthogonal with being imperative or not. Ocaml has support to object orientation, but it is normally programmed declaratively. I have edited the book, to make this distinction more clear.
 * Aren't you mixing together procedural languages and imperative languages ? There are points of contact but they are not the same concepts (all imperative languages are procedural languages but not all procedural languages are imperative ones). Where do you define the line, or better yet, when does a language cease to be fall under the imperative paradigm to belong to another. And what paradigms do you see concurrent to the imperative ? --Panic (discuss • contribs) 21:33, 28 May 2012 (UTC)
 * Well, I believe that either the language is imperative or declarative. Member of the former follow the formalism called Turing Machine. The key point is the presence of a state. Declarative languages are further divided into functional and logic. Functional languages follow the lambda-calculus. Logic languages follow Horn Clauses. In another dimension, a language can be object oriented (programming intelligence is on the type), or procedural (programming intelligence is on the operations). In OO languages you tend to develop programs bottom up "which types do I have". In procedural languages, you tend to approach problems from a top down perspective. "What is the algorithm that must be solved, and how can I expand it in sub-algorithms".
 * Ok it then becomes important to carefully define declarative languages (since the concept can be extremely murky). I now get your meaning and agree with you on the split but continue to believe that the distinction you are making is between procedural and declarative (not imperative). When I studied the programming paradigms there were only 3 types of paradigms. The imperative, the object oriented and the logical paradigm and I have a hard time making a distinction between the recent evolutions as being anything more than sub-categorizations of those major ones (and for what I understand this type of difficulty is generalized). So to understand why I make a clear distinction between imperative and declarative...
 * Most older languages are imperative from Basic to C (even if C now starts to permits some higher level of abstraction). Objects themselves may not define the Object Oriented Paradigms. My understanding is that the categorization is more dependent on how the language permits to approach problems, the best example of OO is smalltalk next we have Java (and so Java is not an imperative language). In this the distinction between imperative paradigm and procedural programming approach that I defend (even if I accept that some people, but not all, use the terms interchangeably) becomes more useful, since it permits to clearly make a distinction between the two paradigms not specific to the language structures, but how it addresses problems (the modeling of). It also makes it clearer the examination of multiple-paradigm languages, being the C++ a prime example.
 * Logic paradigm is something that is clearly exemplified by Prolog.
 * As for Functional Programming I would not classify it as a specific paradigm as it does not define a specific way to address problems, and it was in general terms an evolution of multi-paradigm languages, a higher order of abstraction derived from generic programming. I understand the motivation to establish it as a programming paradigm on its own, but I find it hard to fit it in the classic paradigm model without breaking it. I see it as belonging to a subspace of the multi-paradigm languages, in fact most of the multi-paradigm language do support functional programming. --Panic (discuss • contribs) 22:54, 28 May 2012 (UTC)
 * Thank you for taking the time to discuss these issues :) The distinction, at the semantic level, seems clear to me. What is the semantics of a C program? It is a function that takes a state (map of variable names to values) and produces another state. That is the same semantics of languages as diverse as python, Java, C++, etc. But, what is the semantics of a sml program? It is a value. Any purely functional program is ultimately a value. Here, a value can be a function. Indeed, you can represent numbers using functions, like in Church numbers. The same semantics applies to Haskell, lisp, Erlang, etc. But only to the purely functional subset of these languages. In these languages it is more natural to program considering that each program is a value. But, for efficiency reasons, most of them also give the developer the opportunity to keep track of states. Haskell is an exception, and their designers have tried very hard to stick to the purely functional way to program (they had some serious problems when dealing with i/o, but that is another matter). But, of course this distinction is murky: as we added in the first chapter, after your comments, one can develop programs in a more imperative way, or in a more declarative way, even if that is not very natural given the language choice.--Pronesto (discuss • contribs) 23:49, 28 May 2012 (UTC)
 * This is not my area of interest. I'm one of those that like to look into programming as a form of art, a craft, not something that can easily survive process engineering and continue to be as useful, especially when dealing with lower level languages or extremely high level ones like most functional programming.
 * I would classify C as an imperative language that through its semantics uses lower procedures (C runtime) to execute algorithms in a deterministic way. C can have objects but its approach to problems is strictly imperative. But the paradigms as I see it are not defined by semantics but by how the language can model problems. Java does not model problems in an imperative way, it clearly relies in the object oriented paradigm to deal with problems, but still remains procedural in nature. As you state semantically C and Java are very close but they model problems very distinctively, Java also permits generic programming and even functional programming but it should not be classified as a multi-paradigm language, because even then it models problems through the objective programming paradigm. The same is not the case of C++ that also shares the same semantics but permits not only exclusively imperative or object oriented paradigm approaches but a mixing of the two, while also permitting generic and functional programming.
 * To me this clearly indicates the reason why it is difficulty to define functional programming as programming paradigm per se, the scope of problems that can be modeled is limited, in a way the problem is very similar to logic programming. If it was up to me I would define these types as belonging to a meta paradigm (not to be confused to meta programming)...
 * I agree that Haskell is to Functional programming as Pascal is to Imperative programming or as Smalltalk is to Object Oriented Programming or even as Prolog is to Logic Programming. It is the optimal example. SML is multi-paradigm, now that I think on it I can't remember another strictly functional programming language beyond Haskell...  --Panic (discuss • contribs) 01:06, 29 May 2012 (UTC)