r/functionalprogramming • • 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:

  1. No "Null"
  2. No OOP (or at least just a tiny subset)
  3. Immutability by default
  4. Discriminated Unions (or similar concept)
  5. Statically typed
  6. Type inference
  7. 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?

65 Upvotes

105 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Feb 29 '24

The problem is that (in my opinion) it is very cumbersome and unpleasant to program functionally in C++, even if it is possible. But this applies to any imperative or object-oriented language. Conversely, it is unpleasant to program imperatively or object-oriented in a functional language, even if the language supports it.

It is possible to have both in the same language.

Rust is a good example. It primarily tries to be imperative but functional style is quite possible in it.

Haskell is not only functional, but purely functional, which means that its semantics excludes the possibility of side-effect. Still: it is possible to express imperative algorithms in it, on the purely functional base, without losing purity, in a very imperative style. Even in-memory-place mutation is possible, in 2 ways even, without loosing purity. The saying "Haskell is the best imperative language" is true. See [this](https://vaibhavsagar.com/blog/2017/05/29/imperative-haskell/) for example.

This is simply due to the opposing concepts. Imperative programming requires the mutability of variables, whereas in functional programming, mutability is more than undesirable.

It is possible to mutate, even in-memory-place even in a purely functional setting. What functionality excludes is side-effects, not effects, not mutation.

2

u/Voxelman Feb 29 '24

Rust is designed from the ground up. C++, Java or C# are OO languages with some functional goodies glued around. In my opinion not really fun to use.