News for hackers. Stuff that matters.
Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @07:38AM (#27412427)
> "functional programming" which in comparison has a glas clear definition

Does it?

Re:The Repeated Deaths of OOP (2015) by ebingdom on Sunday June 06, 2021 @08:42AM (#27412764)
I would say it doesn't have a formal 100% unambiguous definition, but it's certainly _more_ well-defined than OOP: a functional programming language is one which is based on lambda calculus.
Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @08:49AM (#27412801)
Isn't every existing programming language eventually based on (or at least traceable to) lambda calculus? OOP is just another way to organize code.

Human language is unsuitable for "glass clear", unambiguous definitions, just because of its inherent fuzziness (which is nota bene an essential property for efficient communication).

Re:The Repeated Deaths of OOP (2015) by carapace on Sunday June 06, 2021 @03:09PM (#27415459)
> Isn't every existing programming language eventually based on (or at least traceable to) lambda calculus?

No.

Prolog et. al. is based on Horn Clause representation and evaluated using something called SLD resolution.

"Concatinative" languages (like Joy) are based on function composition (not application.)

(FWIW, the Turing machine is not based on Lambda calculus. Not that TMs are a programming language.)

Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @03:44PM (#27415704)
Aren't turing machines and the lambda calculus equivalent, i.e. each can efficiently simulate the other?
Re:The Repeated Deaths of OOP (2015) by carapace on Sunday June 06, 2021 @09:12PM (#27417951)
They're equivalent, but not identical. Lots of formal systems are Turing complete (e.g. Wang Tiles) and so can compute the same results as each other. Wolfram goes on about this some.

I sometimes wonder about the possible form of the "Platonic Ideal" is that each of these systems represent. George Spencer-Brown's Laws of Form seems to me to be the ultimate concrete example, but that's not a universally held opinion. :)

Re:The Repeated Deaths of OOP (2015) by Rochus on Monday June 07, 2021 @06:05AM (#27420801)
But doesn't that mean you can create a corresponding lambda calculus based version of a programming language, such as Landin did in his 1965 paper?
Re:The Repeated Deaths of OOP (2015) by carapace on Monday June 07, 2021 @12:33PM (#27424525)
Of course, but you could do that with the other formal systems too.

It's like Roman numerals vs. base-10 numerals, eh? "XXIII" and "23" both denote the same number (which may or may not exist depending on your metaphysical outlook) but neither notation can be said to be "the" notation.

Re:The Repeated Deaths of OOP (2015) by Rochus on Monday June 07, 2021 @02:06PM (#27425905)
That's ok; my concern was just whether "every existing programming language eventually based on (or at least traceable to) lambda calculus" responding to the fellow which claimed that "a functional programming language is one which is based on lambda calculus".
Re:The Repeated Deaths of OOP (2015) by ebingdom on Sunday June 06, 2021 @08:55AM (#27412836)
> Isn't every existing programming language eventually based on (or at least traceable to) lambda calculus?

Not really. FP has an obvious connection to lambda calculus. Many OOP languages don't even have a straightforward notion of "function", which is what lambda calculus is all about.

Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @11:01AM (#27413642)
> Not really

See e.g. Landin, P. J. (1965): A Correspondence between ALGOL 60 and Church's Lambda-notation.

Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @09:03AM (#27412869)
Re:The Repeated Deaths of OOP (2015) by ebingdom on Sunday June 06, 2021 @09:23AM (#27412992)
Yes, that's one of the most prominent in a long line of attempts at creating formal models of OOP. And in the preface, you'll find:

> There is a well-established theory of functions, the λ-calculus, ... However, our theory of objects is self-contained; it is the first that does not require explicit reference to functions or procedures.

So that answers your question in the negative and proves my point: no, not every language is based on lambda calculus.

Re:The Repeated Deaths of OOP (2015) by Rochus on Sunday June 06, 2021 @09:40AM (#27413074)
There are also different "schools of thought" for functional programming. That in itself is not a bad thing. The thread was about formal definitions; such are therefore available for those who need them.
Re:The Repeated Deaths of OOP (2015) by kaba0 on Sunday June 06, 2021 @01:52PM (#27414861)
How are expressions not based on lambda calculus in most “ordinary” languages? Yeah, they may side effect but at the same time lambda calculus itself is untyped, so is Haskell all that much closer to it over C++?
Re:The Repeated Deaths of OOP (2015) by tome on Sunday June 06, 2021 @02:02PM (#27414935)
Many other languages are not expression based at all. for loops cannot be considered "lambda calculus", for example (although of course there is a translation of them into a lambda calculus equivalent).
Re:The Repeated Deaths of OOP (2015) by kaba0 on Sunday June 06, 2021 @02:08PM (#27414992)
While they do have statements as well, they usually also have expressions, which are referentially transparent (and yeah I know it’s not the usage most people use, but it is the correct one: https://stackoverflow.com/questions/210835/what-is-referenti... ). (They don’t employ currying though)
Re:The Repeated Deaths of OOP (2015) by tome on Sunday June 06, 2021 @03:29PM (#27415609)
I never quite understood Uday's objection. Any language can be referentially transparent if you consider it's denotation to be just its syntax. Then you can always replace equals with equals, but the only thing equal to an expression is the exact same sequence of characters! The whole point is to be referentially transparent with respect to as coarse a semantics as possible. Haskell gets some of the way there, yet even

    let x = e
        y = e
    in ...
is not equivalent to

    let x = e
        y = x
    in ...
if your semantics can distinguish expressions by the time they take to evaluate.

Still (to address your original question) people do consider lambda calculi with effects, so if the expression-based fragment of an imperative language supports lambdas with lexical scoping then sure you could get away with saying that "their expression are based on lambda calculus".

Re:The Repeated Deaths of OOP (2015) by kaba0 on Sunday June 06, 2021 @03:51PM (#27415759)
I’m having a “debate” about it at another thread as well, so let me just point to a perhaps better explanation: https://elarib.com/item?id=22141647

So taking eg. Template Haskell, you actually loose referential transparency since then even the syntax itself matters and you can’t just replace it to an equivalent expression. I have no experience with Template Haskell itself so bare with me, but eg. having a macro m that converts the constant 2 to the string “two” while others to empty string will fail to be referentially transparent since `m 2` will not be the same as `let a = 2 in m a`.

Re:The Repeated Deaths of OOP (2015) by tome on Sunday June 06, 2021 @04:09PM (#27415890)
Firstly, I'm not sure you can even write that in Template Haskell. The syntax would actually be

    let a = 2 in $(m a)
and since `a` is not in scope at the time the TH splice runs compilation will fail. Secondly, even if you could write it, I don't really think something that contains Template Haskell should be called a "Haskell expression".

With regard to pron's comment, he has a long history of being technically correct with regard to Haskell. The operative point is

> What they mean is that the language is referentially transparent (like most language) and a term's reference (denotation) is an object value in the language

i.e. Haskell is referentially transparent with respect to a particularly coarse semantics (value semantics).

Anyway, your greater point that referential transparency doesn't imply immutability is completely correct.

Re:The Repeated Deaths of OOP (2015) by valenterry on Sunday June 06, 2021 @09:21AM (#27412976)
Yes, please see my other answer - it is much stricter/clearer defined than any OOP definition that I've seen.
Re:The Repeated Deaths of OOP (2015) by Zababa on Sunday June 06, 2021 @12:31PM (#27414217)
If I understood you correctly, you say that functional programming is what people usually call "pure fonctional programming"? If that's the case, the definition is better than OOP, but I don't think it's a property of functional programming but just that OOP is talked about more by more diverse people.
Re:The Repeated Deaths of OOP (2015) by valenterry on Sunday June 06, 2021 @07:14PM (#27417243)
Yeah - the term "functional programming" is nowadays as unclear as OOP. But "pure functional programming" is not - there is no equivalent in the OOP world.