4 ms·
To add to my parent comment, I think there’s another point to be made here: ‘post-paradigm’ is, to some extent, a contradiction in terms. You can’t build a lang
by bradrn 3y ago
To add to my parent comment, I think there’s another point to be made here: ‘post-paradigm’ is, to some extent, a contradiction in terms. You can’t build a language without its basic structure implying some paradigm (or possibly more than one).
There’s a perspective I find useful here. I tend to think of different ‘programming paradigms’ as different approaches to solving problems. In imperative languages, you solve problems by modifying values in sequence until you get to the answer; in functional languages, you solve problems by building up a function which gives you back the answer; and so on.
The key thing here is, you do need to give yourself some way of solving problems. That translates directly to the paradigm which your programming language adopts. If you give yourself more than one way of solving problems, then the language becomes multi-paradigm. In rare cases, you might even end up inventing a totally novel problem-solving approach, and hence a new paradigm… but even that’s not ‘post-paradigm’, it’s just another paradigm.
- klabb3 3y agoReplying here to both. I don’t disagree on any of your technical points. But I also think for practical purposes you’re missing the forest here. I agree with the sentiment of the article - I think the big trend in general purpose PLs is a blend of multiple classical paradigms. Perhaps we’re moving the goalpost and paradigms need to be rearranged - but that is intrinsically interesting - it’s literally the continents of knowledge drifting slowly into new configurations. Single-paradigm languages like prolog, CSS or SQL keep their restrictions not because the lack of use-cases, but because the benefit of keeping the complex execution engines away from the end-user exceeds the minor wins in expressiveness. I don’t think it’s a coincidence that the declarative languages are in this category. They are higher level, and opening up low-level customizations is really tricky: for instance, if you put imperative code inside your CSS, it needs complex “re-evaluation rules”, that results in a dilemma: either give full control to the programmer, which imposes specific execution engine designs and complex API surfaces – or re-evaluate too often, which risks killing memoization and perf (cache invalidation). It could be even worse if the code has side-effects or dep cycles. On the contrary, imperative low level languages like Rust can easily come along and say things like: “this is not only a function, but a side-effect free function”. “This is not just a reference, but an immutable reference”. Then you can cleverly leverage those traits in your “execution engine” ie the compiler, to deliver low-level perf. There are even people who describe rust as a high-level language for these reasons, which is a bit provocative to me but in all honesty not completely outrageous. An alternative take on the last 10-15 years: - General purpose PLs typically have an imperative base, while integrating multiple classical paradigms: - Only a few aspects of OOP are added to modern PLs, where inheritance has largely been superseded by simpler composition - Features from FP have surged in popularity, being integrated and even retro-fitted into general purpose PLs, providing both perf- and DX improvements - Structured meta-programming and/or codegen has been a strong focus for compiled languages, acknowledging that it’s preferable to limit the complexity of the core language at the expense of separate pre-compile phases
- lispm 3y agoI don't think Prolog is a single paradigm language. It just has one dominant paradigm: Logic Programming. But in actual Prolog systems you'll find procedural programming, constraint programming, object-oriented programming, meta programming (programming on the language level).
- klabb3 3y agoTIL. Would it be better to say that Prolog is a general purpose PL, albeit more archaic than what we typically think of?
- lispm 3y agoI don't know what you mean by "archaic". But here are a few pointers: Visual Prolog, https://www.visual-prolog.com https://www.visual-prolog.com Once it was Borland's Turbo Prolog. Quote: "It combines the best features of logical, functional, and object-oriented programming paradigms, offering a powerful, type-safe, high-level language. Visual Prolog is well-suited for developing applications for Microsoft Windows 32/64 platforms and supports advanced client-server and three-tier solutions." There is a comparison of Prolog implementations on Wikipedia: https://en.wikipedia.org/wiki/Comparison_of_Prolog_implementations https://en.wikipedia.org/wiki/Comparison_of_Prolog_implement... This explains the OOP extensions of SICStus Prolog. https://sicstus.sics.se/sicstus/docs/3.7.1/html/sicstus_35.html https://sicstus.sics.se/sicstus/docs/3.7.1/html/sicstus_35.h... I haven't researched this, but there should be zillions of language extensions like this to Prolog. It is one of the symbolic AI languages, as such it has a long history of extensions.
- bradrn 3y ago> I don’t disagree on any of your technical points. But I also think for practical purposes you’re missing the forest here. I agree with the sentiment of the article - I think the big trend in general purpose PLs is a blend of multiple classical paradigms. You’re not wrong. That may even be the sentiment of the article. But the article certainly doesn’t phrase it that way — it’s saying that modern programming languages are ‘beyond paradigms’. That’s clearly wrong, and that’s what I’m arguing against.