5 ms·
From https://github.com/kachayev/fn.py https://github.com/kachayev/fn.py : > There are theoretical and practical advantages to the functional style: > - Forma
by catnaroek 9y ago
From https://github.com/kachayev/fn.py https://github.com/kachayev/fn.py :
> There are theoretical and practical advantages to the functional style:
> - Formal provability
This is bollocks. To prove things about your programs, you need a formal semantics for the language you're using.
- bionoid 9y ago> This [Formal provability] is bollocks. How precisely does modularity, composability and ease of debugging improve from this module? Not at all. It may have benefits, sure. But to claim these as general attributes is just sophistry in my personal opinion.
- catnaroek 9y agoAgreed. I just felt a stronger need to comment on the zeroth bullet point in the list.
- lmm 9y agoFunctional style makes it easier to have a natural semantics that corresponds directly to the language proper: you can use a small-step semantics where evaluation is just reduction, and you then have a very simple and natural denotational semantics (the denotation of an expression is just the value it evaluates to) that obviously corresponds directly to your operational semantics. All that is much harder to do with programming styles that make use of pervasive, implicit state.
- catnaroek 9y agoA semantics is a property a programming language, not the style you happen to program in. --- @lmm > In practice no practical language provides formal semantics for the entire language Programming languages are mathematical objects and always have a formal semantics, regardless of whether someone has taken the trouble to write it down or not. What I'm saying is - the formal semantics that most languages have preclude the existence of compound values. Without those, you can't define interesting functions, and thus you can't program in a functional style.
- lmm 9y agoIn practice no practical language provides formal semantics for the entire language, only for restricted subsets of it i.e. particular styles within the language.
- lmm 9y agoResponding to edits: > Programming languages are mathematical objects and always have a formal semantics, regardless of whether someone has taken the trouble to write it down or not. Not true for the usual plain-english meaning of "programming language". Plenty of things we call programming languages take a "the implementation is the spec" view, or simply can't be assigned any useful semantics in a way that's at all aligned with the defining characteristics of the language in question. Even in, say, Haskell, io explicitly lacks formal semantics. > What I'm saying is - the formal semantics that most languages have preclude the existence of compound values. Without those, you can't define interesting functions, and thus you can't program in a functional style. Python tuples are perfectly cromulent compound values. Python has a bunch of builtin classes for which the equality operators that are available in the language are all kind of useless, sure, but that's true in almost all languages.
- catnaroek 9y ago> Plenty of things we call programming languages take a "the implementation is the spec" view, And do you think the implementation isn't a mathematical object itself? > or simply can't be assigned any useful semantics in a way that's at all aligned with the defining characteristics of the language in question. This is a contradiction in terms. By definition a semantics is a mathematical descrpition of the meaning of a programming language, i.e., the behavior of its programs. Sometimes a semantics exposes significant differences between the mental model of programmers and what a programming language really is, but the solution is not to turn a blind eye to reality. > Python tuples are perfectly cromulent compound values. So long as they have object identities, they are not values. Values are merely represented in memory - they truly exist in the language's semantics.
- lmm 9y ago