Why is it that virtually all new languages in the last 25 years or so have a C-like syntax?

- Java wanted to sort-of knock off C++.
- C# wanted to be Java but on Microsoft's proprietary stack instead of SUN's (now Oracle's).
- Several other languages such as Vala, Scala, Swift, etc. do only careful evolution, seemingly so as to not alienate the devs used to previous C-like languages.
- Not to speak of everyone's favourite enemy, JavaScript…
- Then there is ReasonML which is basically an alternate, more C-like, syntax for OCaml, and is then compiled to JavaScript.

Now we're slowly arriving at the meat of this rant: back when I started university, the first semester programming lecture used Scheme, and provided a fine introduction to (functional) programming. Scheme, like other variants of Lisp, is a fine language, very flexible, code is data, data is code, but you get somewhat lost in a sea of parentheses, probably worse than the C-like languages' salad of curly braces. But it was a refreshing change from the likes of C, C++, and Java in terms of approach.

But the real enlightenment came when I read through Okasaki's paper on purely functional data structures. The author uses Standard ML in the paper, and after the initial shock (because it's different than most everything else I had seen), and getting used to the notation, I loved the crisp clarity it brings with almost no ceremony at all!

After looking around a bit, I found that nobody seems to use SML anymore, but there are viable alternatives, depending on your taste:

- Pragmatic programmers can use OCaml, which has immutability by default, and tries to guide the programmer to a functional programming mindset, but can accommodate imperative constructs easily when necessary.
- F# was born as OCaml on .NET but has now evolved into its own great thing with many upsides and very few downsides; I recommend every C# developer should give it a try.
- Somewhat more extreme is Haskell, with its ideology of pure functions and lazy evaluation that makes introducing side effects, I/O, and other imperative constructs rather a pain in the arse, and not quite my piece of cake, but learning it can still help you be a better programmer in whatever language you use on a day-to-day basis.

Anyway, the point is that after working with several of these languages developed out of the original Meta Language, it baffles me how anyone can be happy being a curly-braces-language developer without craving something more succinct and to-the-point. Especially when it comes to JavaScript: all the above mentioned ML-like languages can be compiled to JavaScript, so developing directly in JavaScript should hardly be a necessity.

Obviously these curly-braces languages will still be needed for a long time coming, legacy systems and all—just look at COBOL—, but my point stands.

  • 1
    This is coming from someone who uses mentioned languages professionally: fp is only viable as the smallest building block. Scala has akka, because having an own implementation functors is simply not doable in large scale environments. Ocaml has objects because its really cool to a|>b|>c everything, but after going upwards from functions, your codebase becomes an unmaintainable mess.
  • 2
    Simply because it's tried and tested. What do you suggest instead of curly braces?
  • 3
    Indentation works, in my experience. I was apprehensive about it at first, it's a bit of an acquired taste, but it works well.
  • 1
    > after going upwards from functions, your codebase becomes an unmaintainable mess

    @yellow-dog That's what modules are for.
  • 0
    No, thats not what modules are for, they are for separation of concerns
  • 0
    I may be wrong but the reason almost every language look like Java is because Java is popular. Java become popular since it solve one of the problem of it times (there are different platform and how to make our program at those different platform) Java solve the problem with JVM. JVM is the most important feature of that time.

    Since everyone use Java other language at that time try to market it to developer like "Hey try our new language.It's just like Java."

    I agree that FP have make our problem simpler but it is not the tool for every problem.For every in graphic intense problem such as photo editing tool , it's not a good idea to copy the entire matrix just because single pixel change.
  • 0
    I would say that FP turns to the same level of mess that people can have in other paradigms. Whereas in C like languages, and I am speaking mostly from a Java/C# point of view, your mess involves a complicated hierarchy of design patterns, these are easily distinguishable from people wanting to be cute with FP. Now, don't get me wrong, I love F# and what little I know about Scala, and I am here one of the biggest fans of Clojure and have used it at work to write a small utility. But something that made complete sense to me in Clojure did not made sense to other people, even if I tried to make it as idiomatic as possible. FP composition can be just as complex if not more than complex oop hierarchies, but at least in my point of view it is easier to discern separation of concerns with standard curly bracketed oop languages.

    A good mix of both in which there is damn near no syntax and good spacing considerations exist? for me it is Smalltalk, I wonder what you would think about Pharo.
Add Comment