4 ms·
Programming language with all features
Would it be possible to implement a programming language that supports as many features and paradigms as possible? If you want to use a target runtime, which one would be best? CLR, JVM, GraalVM (with Truffle) or something else?
Maybe native like LLVM would be best because runtimes make assumptions that can be a limit but I thought of a runtime target like CLR or JVM so that I can access the whole ecosystem of libraries provided.
Regarding GraalVM I read in this document (https://www.oracle.com/a/ocom/docs/tools/graalvm-ee-white-paper.pdf):
"Computer virtualization has been a consistent trend for the past 20 years. While “virtualization” and “virtual machines” (VMs) mean different things in different contexts, they have a couple of goals in common: the isolation of code from other code running in the same machine and the ability to write once, run anywhere. To date, this virtualization vision has been incomplete. That’s because traditional virtualization approaches don’t address the issue of multiple programming languages. Meanwhile, the number of programming languages in use continues to increase. So, virtualization’s multilingual problem is growing. Attempts to build multilingual runtimes to fill this void have fallen short with poor performance and an inability to support all the semantics, features, and native extensions libraries of the new languages. But all that is changing with GraalVM language-level virtualization."
- kazinator 5y agoSome of the features are philosophically conflicting. I.e. sometimes it is a feature of some language that it specifically doesn't have certain features. For instance, you can't have functional purity and assignment to variables and mutable object fields; you have to pick one.
- galaxyLogic 5y ago> Would it be possible to implement a programming language that supports as many features and paradigms as possible? Maybe it would be possible but it would be impractical and wasteful because 1. It would make it harder to learn all those features and easier to make errors in such a language when it is hard to learn. 2. You don't need all possible features because you can implement the same program using different features, features provide overlapping ways of doing the same thing. It would be like trying to define a natural language that supports the syntax of all natural languages. The challenge is not to create a language with more or all features. It is to provide a small subset of all possible features that makes it easy to write most programs in a very understandable manner. The problem with programming is trying to understand the programs created. You need to be able to understand the programs easily, economically, because else their maintenance becomes costly.
- HelloNurse 5y agoThe niche of "multiparadigm" programming languages is unusual because the easy way to write a general programming language is to make it low level and "no paradigm" (extreme case: virtual machines that externalize the language design layer) while the easy way to support a certain paradigm is making choices that hurt supporting other paradigms (most universally, going all-in on some feature to the exclusion of the opposite ones, like automatic and never explicit memory management in Java, or leaving second-class syntax and second-class implementations for everything else, like functions and types vs. records and strings in Haskell).
- Axeryon 5y agoDo you know Truffle for GraalVM? Support various types of languages, even very different from each other. https://medium.com/graalvm/java-on-truffle-going-fully-metacircular-215531e3f840 https://medium.com/graalvm/java-on-truffle-going-fully-metac... https://www.graalvm.org/22.0/graalvm-as-a-platform/language-implementation-framework https://www.graalvm.org/22.0/graalvm-as-a-platform/language-...
- Axeryon 5y agoI want to understand only any technical limitations (such as the incompatibility that some features may have), regardless of the success it would have in the market
- HelloNurse 5y agoWhat are you asking about? Intentionally complex but relatively single-paradigm programming languages (e.g. PL/I, Ada, C++, the scripting language in Mathematica)? Flexible languages that can bend to support multiple paradigms (e.g. LISP, Forth)? Virtual machines that can run anything you compile for them but give up defining a single programming language?
- Axeryon 5y agoMaybe Lisp and Forth are closer to what I mean, but it should also have a more solid type system and allow for a high level of abstraction and static checks by the compiler
- johntdaly 5y agoWhat you are talking about is something along the line of OZ/Mozart or Alice ML. These type of languages are not usually used to program actual applications in. They are used to teach programming language concepts and how they relate and build on each other. “Concepts, Techniques, and Models of Computer Programming” is a book that uses OZ because they thought it would be easier to teach the different concepts with one language in one semester. It is more common to have books that try to teach different programming languages concepts by teaching them using languages that implement those concepts. But if you do that you will most likely also need to learn multiple different types of syntax. Alice is another try to unify multiple programming concepts in one ML based language and there is at least one github repo out there trying to translate the code in “Concepts, Techniques, and Models of Computer Programming” from OZ to Alice. The reason these types of languages are unusually academic only is because it is a bad idea to mix to many idioms in one language. Look at C++, some people think it is impossible to program in C++ but only in subsets of C++ because it has features that don’t really work well together. Other people have the same idea about Scala. Object-relational impedance mismatch mismatch is another subject where different idioms don’t quite mix.
- Axeryon 5y agoOZ is very similar to what I mean and would actually be a bit awkward to use in software development
- nikonyrh 5y agoClojure is an example of a minimal language, and many of its advanced features are implemented via a macro (such as for loops, you can check its source code here: https://github.com/clojure/clojure/blob/clojure-1.10.1/src/clj/clojure/core.clj#L4624 https://github.com/clojure/clojure/blob/clojure-1.10.1/src/c...). You are able to implement many paradigms without having to release a new version of the language itself. This also applies to LISP, and I assume many other languages with macros. Well arguably JVM puts some limits on the language's practical application.