r/functionalprogramming • u/Voxelman • Feb 29 '24
Question Are "mainstream" languages dead?
I want to know what new languages are currently developed in the last few years, that have the potential to become at least some importance.
Because all new languages from the last years I know of have lots of things in common:
- No "Null"
- No OOP (or at least just a tiny subset)
- Immutability by default
- Discriminated Unions (or similar concept)
- Statically typed
- Type inference
- No exceptions for error handling
All newer languages I know have at least a subset of these properties like:
Rust Gleam Roc Nim Zig
Just to name a few I have in mind
In my opinion programming languages, both mainstream and new, are moving more and more towards more declarative/functional style. Even mainstream languages like C++, C# or Java add more and more functional features (but it's ugly and not really useful). Do traditional languages have any future?
In my opinion: no. Even Rust is just an intermediate step to functional first languages.
Are there any new (serious) languages that don't follow this trend?
37
u/AxelLuktarGott Feb 29 '24
The languages that have the properties that you describe already exist and don't need to be created again. It's not weird that new languages are different from existing languages. A better metric for how "dead" those paradigms are is probably to look at what programming languages are used the most.
But new languages all moving away from some old and bad ideas are probably indicative of the majority agreeing that those ideas were bad.
7
u/[deleted] Feb 29 '24
That's just a current trend. I don't oppose it. I like the direction. But every such trend leads to an opposing movement a few years later. The grass is ALWAYS greener on the other side š
11
u/[deleted] Feb 29 '24
There is nothing wrong with using `null` as long as its represented as a type within the type system and the type system allows for working within nullability
13
u/KaranasToll Feb 29 '24
Programming language trends are cyclical. I'll use exceptions (or some automatic stack unwinding construct)Ā for errors as an example. In C, you typically return a sentinel value or use some global error number variable for errors.Ā
People got tired of having to check this after after function that could fail and manually bubbling up the error (also sentinal values are cursed). With exceptions, you can put one error handler around a bunch of code and the errors live in a totally separate space than the return values; if you get a return value, you are good to go.
Ā Then people go tired of tired of having their program crash from unhandled exceptions, so they figured out how to use sum types to represent errors. That us easily checked by the type system. Now we have safety, but we are back to manual stack unrolling and checking of return values (granted the type-checker reminds us to check the return value now).
I think exceptions are conceptually better. I like having errors being separate from the return type. Sum types try very hard to mimick things that exceptions do like automatic stack unwinding and stack traces. Exceptions can do things that are not practical with sum types (check out restarts in Common Lisp).
Once people learn how to nicely guarantee that all exceptions are handled (Java's half-thought out checked exceptions do not count), new programming languages will switch to having exceptions.
I may have gotten the time line a bit off, but I think it is good enough for example. I'm going off when the concepts became popular rather than their actual invention.
2
u/[deleted] Feb 29 '24
I'm sorry to answer a question with a question and I'm asking because i don't know, not because I'm trying to be clever: Isn't it kind of pointless to have C++ lean back to being functional rather than object orientated,? Wasn't it supposed to be an object orientated version of C? Does it bring anything extra to the table for functional programming?
2
u/notSugarBun Feb 29 '24
Nope, they'll still be needed for maintaining older pieces
25
u/SV-97 Feb 29 '24
There definitely are other new languages as well. Julia, Raku and Mojo come to mind for example; Dart for example also isn't that much older than Rust etc.
I think we're seeing less of the current mainstream in new languages because we already have pretty good languages for that and the incentive to move to a new language would be smaller if it mostly does what current languages are already doing. The "old" design space has been explored for two-to-three-ish decades and lots of people found some of the features from it to be "bad", foster bugs and bad design, misuse or whatever so we mostly try to move away from those in new languages.
EDIT: I think this post would suit r/ProgrammingLanguages better btw
3
u/burtgummer45 Feb 29 '24
swift and typescript?
3
u/SoftEngin33r Feb 29 '24
Crystal is an OOP language that is new, But it compiles much like Go, both have embedded GC in the actual native binary without a need for installing a supporting runtime.
Also Zig is rather imperative and not functional, Its main cool feature is the compile time code execution to create generic types.
7
u/v3vv Feb 29 '24
I donāt want to come off as rude or like Iām lecturing from a lofty perch but this discussion really highlights the generational gap in programming perspectives.
Thereās no such thing as mainstream languages and whatās considered āmainstreamā is essentially the flavor of the month.
Back when I got into programming the discussion was about why every mainstream language was hopping onto the JIT compiler bandwagon and why they were all gravitating towards VMs.
Think of ātimeā as an array of events - āmainstreamā is just a function that applies a sliding window to this array giving us a snapshot of the current trends.
4
u/delfV Feb 29 '24
What would be a point in implementing another heavy OOP languages? If one want to do OOP they already have plenty of languages to choose from.
And not only staticly typed languages are being developed. Clojure and Elixir are examples of modern dynamic languages and AFAIK (not sure) they're the most popular functional languages at the moment
4
u/lightmatter501 Feb 29 '24
The other popular recent language is Go, make of that what you will.
2
u/spectateswamp1 Feb 29 '24 edited Feb 29 '24
I've been working on a Search Engine since 1999..
I avoided OO... It can be added in phase 2
This app does everything I'll ever need.
https://ia801400.us.archive.org/20/items/spectate-01-sep-2022/spectate%2001Sep2022.txt
When displaying items highlighted in Context mode...
And the enter key HELD down
The matches flash by so fast that patterns appear...
You don't have to read the results... Just scan....
2
u/fridofrido Feb 29 '24
1,3,4,5,6 (so 5 out the 7) are undeniably GOOD IDEAS.
2 is probably a good idea, but debatable. 7 probably depends on the context, if a function can fail only in limited ways, it's probably better to return a discriminated union.
2
u/drinkcoffeeandcode Mar 01 '24
Ugly and not really useful? Streams and method references in Java 8 made it an immensely more pleasant language to use.
2
u/oa74 Feb 29 '24
Reading your other posts, it seems as though your definition for a "dead" language has to do with the extent to which greenfield projects are written in that language. Being that numerous languages have come forth with the express intent of becoming a "successor" to C/C++, it's obvious that there is tremendous thirst among the users of these languages to move on to something a little fresher. So in that sense, the old "mainstream" languages are probably "dead," at least in the most common verticals.
Less obvious is the idea that imperative programming is dead.
For example, I could not disagree more with your claim that Rust is just a stepping stone toward more purely functional languages. If anything, Rust caught on precisely because it admits a level of safety akin to functional languages, without forcing them to abandon mutability and the imperative style in general. (Nor, for that matter, saddle them with a GC or enforced purity.) Moreover, the strong interest and optimism surrounding languages like Zig and Jai show that there is tremendous interest in new languages with more of an imperative/C/C++ flavor even than Rust.
Unpopular opinion: the average 20-something who thinks a monad is a burrito is not actually smarter than Bjarne Stroustrup.Ā
...of course, having said that, I won't disagree that C++ is a special kind of punishment.
And while we're on the topic of Jai and Zig, I'll point out that there is one feature these two languages have that is not seen on your list (and rightfully so, as few languages have seen the light and gotten on board), and that is: compile time code execution.
To me, this is a circumlocution of dependent types. Imho, ALL of the items on your list are broadly recognized as good ideas. I think there is substantial consensus on most of them. Dependent types, however, are not as broadly recognized as a "must have" for any new language... but I think they have a ton of potential. The beauty of Zig and Jai is that, by taking a less academic approach, they have been able to communicate and deliver a lot of the value of dependent types without ever speaking of dependent types (c.f. Liquid Haskell).... couched, to boot, in a comfy imperative milieu.
2
u/Kenkron Feb 29 '24
These are going to need a lot more adoption before they have a prayer of replacing C++, Javascript, Java, Python, and C#. At the enterprise level, these are still basically king. Its not just for legacy code either. New projects are still made in these languages. Heck, nginx (2004) and wireguard (2015) are both written in C, which didn't even make the mainstream/traditional list.
2
u/Nuoji Mar 01 '24
āOr a subset of these propertiesā is very wide.
0
u/[deleted] Feb 29 '24
[removed] ā view removed comment