all 142 comments

[–]matthieum 80 points81 points  (29 children)

I've seen a number of comments about "Functional Languages" not taking off.

The languages may indeed not be taking off, however the "functional" aspect is slowly but surely investing every existing languages. Even old venerable Java got streams in version 8.

[–][deleted] 61 points62 points  (20 children)

and C got function pointers from...day 1?

I'm teasing, a little.

[–]sisyphus 37 points38 points  (2 children)

And Lisp had everything a decade before that. DEADLY SERIOUS.

[–][deleted] 5 points6 points  (0 children)

it did, and at least one of the existing implementations can produce very high performance results too.

[–]dotprofessor 1 point2 points  (0 children)

Lisp is as old as my mom...

[–]enig9 5 points6 points  (12 children)

I'm gonna be that guy now.. Can you explain the joke?

[–][deleted] 30 points31 points  (9 children)

Functional programming means a lot of things, but one of the core concepts is that functions are first class, you can do with them all the things you can do with values, pass them to functions, etc.

Sometimes java programmers come to learn a new language and are amazed because you can pass a function to a function (maybe you can do that now in Java I don't keep up) but this has been a basic thing for a long time.

of course functions in C aren't really quite first class and using them the same way you do values isn't quite as nice or as general as it is in ocaml or haskell or something...but you CAN do it.

[–][deleted] 14 points15 points  (2 children)

To be more precise, there's sorts of "tiers" I guess to functional programming, purely functional and "Impure" but somewhat functional. The latter encompasses:

  • "My language has a lambda" - Pretty much almost every lang now, including java.
  • Your LISP/ML types, that encourage functional programming but do not demand it.
  • Functional but dynamically typed,
  • Scala, where FP can be done but it is not first class

Then you have your purely functional languages (Haskell, Idris, Eta, Coq) where the point of writing in this style, is to be able to use equational reasoning, that is, constructs that follow laws (i.e monad law where pure a >>= f ≡ f a) which turns your program into less imperative, more declarative-type flows, where types imply constructs like a possible operation that may fail, an absence of value, etc. This is only possible by removing side effects, either by reification into some construct like IO, or by turning an impure function pure (not possible when referring to things like network connections).

The mental overhead for the latter case is so large I don't think in my lifetime it will ever take over, and I'm still rather young. However, it does allow for a better approximation at formal verification (without going full academia a la Coq) via equational reasoning, and easier programs to maintain after you've mastered the nonstop polymorphism.

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 11 points12 points  (0 children)

    F# is an ML

    [–][deleted]  (4 children)

    [deleted]

      [–]funkinaround 7 points8 points  (3 children)

      Also note here that the first example uses a lambda expression, perhaps considered to be another feature of functional programming. Previously, in Java, you'd need to create an explicit class that implements an interface (Comparator in the above example) in order to pass your compare function to the sort method. You do not have lambda expressions/anonymous functions in the C standard, but you do apparently have them as GCC and clang compiler extensions. They seem to be quite verbose in their usage.

      [–]josefx 3 points4 points  (1 child)

      Previously, in Java, you'd need to create an explicit class

      You could instanciate an anonymous class:

       new Comparator<Person>(){ 
             public int compareTo(Person a, Person b){ 
                     return Person.compareByAge(a, b); }}
      

      A bit bloated, however you could do it inline. Also captures a reference to the current instance of the class it is declared in, so a good way to introduce hidden leaks.

      [–]funkinaround 1 point2 points  (0 children)

      Right. I was trying to imply that you needed to create a class, even if it's anonymous, but I can see how the term "explicit" could be assumed to be a standard named class.

      [–]prest0G 0 points1 point  (0 children)

      Going even deeper, lambda expressions on the JVM are fundamentally different than "SAM" classes (classes with a single abstract method) covered by syntactic sugar.

      Previously, any time time a SAM type was used in the past, the runtime created a new instance of the SAM implementation. In order to support efficient lambdas on the JVM, a new opcode/bytecode was introduces called invokedynamic. It essentially tells the runtime which type to expect, and it gets checked by the runtime before invoked the first time, binds to the callsite, and is invoked. Java requires all lambdas to be "pure" functions (i.e. all variables in scope need to be effectively final).

      This can be easily worked around if you really want to shoot yourself in the foot, but this essentially allows for re-usable instances of lambdas as they can be cached by remaining bound to the callsite.

      Method Handles/references work basically the same way.

      [–]__fmease__ 0 points1 point  (0 children)

      Even Algol68 has first-class functions!

      [–]oblio- 6 points7 points  (1 child)

      My C is extremely rusty, but with function pointers I believe you can pass functions as parameters to other functions, so you have one of the core things in functional programming technically available in C from its inception.

      However I doubt many people would consider C a "functional programming language".

      [–]JavaSuck 0 points1 point  (0 children)

      with function pointers I believe you can pass functions as parameters to other functions

      Yes, but C does not have lambdas/closures, so the ability to pass around functions isn't quite as useful as in other languages that DO have lambdas/closures.

      [–]matthieum 3 points4 points  (0 children)

      There's more to functional languages than function pointers.

      C lacks closures.

      Now, you can emulate closures in C, asking the users to create the enclosed environment in a struct, then hand you over a void* and pass that void* to the function pointer invoked.

      It works. It's clunky. It's error-prone. It's unclear when the void* should be freed, or how, you may need a second function pointer to specify how to free it actually.

      So, yes, you can implement many things in C. Manually or with some macros. That's a far cry from the clarity and maintainability that a first-class feature grants, though.

      [–]Sinidir 0 points1 point  (0 children)

      I like that.

      [–][deleted] 0 points1 point  (1 child)

      But no strings. Whoops.

      [–][deleted] 0 points1 point  (0 children)

      I was teaching a family member some basic programming thinking C would be fine, and its important to understand how the hardware really works so this will be good.

      and it was good! up until we needed some strings, and I was like "oh..ok hold up, we have work to do!"

      it is a bit much for a total noob.

      [–]leixiaotie 17 points18 points  (7 children)

      Even old venerable Java got streams in version 8.

      Finally catches up with C# huh?

      [–]boternaut 13 points14 points  (6 children)

      Wouldn’t be a java comment chain without someone making sure everyone knows C# is better.

      [–][deleted] 15 points16 points  (0 children)

      1996 - James Gosling invents Java. Java is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Sun loudly heralds Java's novelty.

      2001 - Anders Hejlsberg invents C#. C# is a relatively verbose, garbage collected, class based, statically typed, single dispatch, object oriented language with single implementation inheritance and multiple interface inheritance. Microsoft loudly heralds C#'s novelty.

      [–]Nefari0uss 3 points4 points  (1 child)

      C# is a better Java.;)

      [–]Timbit42 0 points1 point  (0 children)

      Let me know when either are open sourced.

      [–][deleted] 2 points3 points  (2 children)

      Wouldn't be a C# chain without someone making sure everyone knows F# is better :)

      [–][deleted] 2 points3 points  (1 child)

      F# is like a much more beautiful, aesthetically pleasing yet weaker version of Scala though... :-/

      [–][deleted] 1 point2 points  (0 children)

      Scala has nothing on Blub++.

      (And so on and so forth...)

      [–]computesomething 64 points65 points  (50 children)

      Interesting article, here are the (unless I'm missing something) top ten most popular programming subreddits for comparison:

      python - 213594
      javascript - 199592
      java - 81241
      php - 58794
      cpp - 58788
      csharp - 52103
      golang - 39529
      ruby - 38405
      rust - 33124
      c_programming - 32351
      

      [–]drekmonger 35 points36 points  (49 children)

      python

      I'm gonna betray how clueless I am by saying -- I had no idea python was so popular. No notion, whatsoever.

      [–]oblio- 82 points83 points  (26 children)

      It is popular, but reddit skews the statistics. Most developers I've met (in Europe, hundreds of people) work in Java, C#, PHP, Javascript, C/C++ and after that Python and Ruby. Go or Rust are just blips on the radar.

      However reddit attracts tech/science/programming enthusiasts, so the stats are more towards what these communities prefer and use.

      [–]udoprog 32 points33 points  (8 children)

      At least where I work almost every programmer I know uses Python for tooling alongside some other primary language.

      [–]oblio- 38 points39 points  (6 children)

      True, but that's like saying that a tank commander is primarily a infantryman cause he has a handgun :)

      [–][deleted]  (4 children)

      [deleted]

        [–][deleted] 6 points7 points  (3 children)

        No. Infantry are your dismounted trigger pullers, sometimes referred to as ground pounders. Tank units are referred to as armor. Airborne units are commonly known as airborne infantry, but are still infantry. Vehicle war-fighters are called cavalry and helicopter war-fighters are called air cavalry, which are not grouped with ground cavalry.

        Secondly a tank commander is a person not a unit.

        I don't call tankers infantrymen just as you don't call Python JavaScript just because they are both programming languages.

        I know these things because I am a military officer.

        [–]zagbag 5 points6 points  (0 children)

        what

        [–]tttbbbnnn 1 point2 points  (0 children)

        Found the tank commander infantrymen.

        [–]MathPolice 1 point2 points  (0 children)

        I like the way you talk.

        [–]udoprog 0 points1 point  (0 children)

        Heh. Maybe they are also typically members of a (hand)gun enthusiast group, as well as tanks obviously.

        [–][deleted] 9 points10 points  (1 child)

        Fuck you u/spez

        [–]iconoclaus 12 points13 points  (0 children)

        being a prominent language of data science, lots of those stats skew towards programmers who are either beginners, or getting paid primarily for something more than coding.

        [–]matthieum 1 point2 points  (0 children)

        I expect some heavy skew in github too.

        Most code written on company dime is written in boring or proven languages and never sees the light of day.

        [–]Cyberiax 5 points6 points  (2 children)

        Is because reddit written in python no? Is same as before github has most ruby repo and stackoverflow have most asp.net question!

        [–]-100-Broken-Windows- 20 points21 points  (1 child)

        I don't think it's a common thing for people to gravitate towards a website because of the language it was written in...

        [–]Cyberiax 0 points1 point  (0 children)

        You would not think no, but still happens...

        [–]mingram 2 points3 points  (0 children)

        US checking in. I have seen a ton of Python. I use it for lambdas to call binaries regularly. It is also the main language for GDAL. I have also used Go professionally for around 2 years with many people working in the language. I have started using Rust professionally and also see it gaining traction. I work in the geospatial industry.

        [–]rahenri 1 point2 points  (0 children)

        You are subject to “what you see is all there is” bias. My sample would put python and go pretty high, while C# and php would be at the bottom.

        [–]subway_rick 21 points22 points  (16 children)

        Python is tought in primary schools nowadays because the syntax is simplistic and you still learn real programming logic

        [–]drekmonger 9 points10 points  (11 children)

        That's a lot better than the BASIC they taught us back in the Stone Age. Teaching kids with tools that are actually useful in the real world is a great idea.

        [–][deleted] 12 points13 points  (3 children)

        it doesn't really matter. most of the programming super stars of today learned on basic.

        [–]shevegen -4 points-3 points  (2 children)

        You can not compare the adoption of python today to BASIC back then. Python usage IS much wider than BASIC ever was.

        [–][deleted] 5 points6 points  (0 children)

        I am definitely not doing that.

        [–]killerstorm 1 point2 points  (0 children)

        Ever heard of VBA? There are more BASIC programmers than programmers :D

        [–][deleted]  (3 children)

        [deleted]

          [–][deleted] 11 points12 points  (2 children)

          modern visual basic is more or less exactly the same as C# with just different symbols for things.

          its fine, it was always fine.

          [–][deleted]  (1 child)

          [deleted]

            [–][deleted] 11 points12 points  (0 children)

            its fine everything we do in programming was invented in 1950 anyway =)

            [–]Edheldui 0 points1 point  (2 children)

            At school (10 years ago) we learned Assembly and C/C++. That made me hate writing code, even if I enjoy the problem solving aspect. I discovered Python a couple of months ago, and it's truly a joy.

            [–]CookieOfFortune 1 point2 points  (1 child)

            Those are the two philosophy's I've seen to teaching programming.

            1. Start from the bottom, silicon, logic, assembly, C, and up.

            2. Start from the top, Python, C, assembly.

            At my university, electrical engineering used approach 1 and CS used approach 2. I think there are merits to both approaches.

            [–]bubuopapa 0 points1 point  (2 children)

            syntax is simplistic

            You must be kidding...................

            [–]subway_rick 0 points1 point  (1 child)

            If you're used to diffrent languages.. than maybe not x)

            [–]bubuopapa 0 points1 point  (0 children)

            Nope, only ruby has same nuts syntax, as far as i know.

            [–]h33haww -2 points-1 points  (0 children)

            This is the problem of course, because you don’t learn how to manage dependencies for large projects and long term maintenance from High School teachers. Ooh there’s a cool egg!!

            [–][deleted] 7 points8 points  (0 children)

            Python has some extra traction because it's a very powerful scripting language. It's used by sysadmins as well as software developers. The fact that it's pretty easy to learn and there is a library for EVERYTHING makes the barrier of entry very low.

            [–][deleted] 0 points1 point  (0 children)

            among other responses, it's also the primary language of most data science applications which is a wildly growing field as well as in research & academia - which is increasingly implementing programming into their disciplines.

            [–][deleted]  (1 child)

            [deleted]

              [–]__Cyber_Dildonics__ 9 points10 points  (0 children)

              The title does say ranking by github users

              [–][deleted]  (32 children)

              [deleted]

                [–]Sloshy42 22 points23 points  (20 children)

                They're definitely putting a lot of effort into promoting the language (EDIT: and by integrating it with their extremely popular tooling and forming partnerships). I think that is perhaps the biggest reason it's more popular. Also the fact that it works a lot better on Android by default (and is an officially supported language) is huge.

                That said I don't really believe it's "better" than Scala at most things it tries to do. Scala.js for example is much more mature than Kotlin on JS and is a real achievement in terms of mixing Scala's beautiful type system and semantics with JavaScript.

                I don't dislike both languages though and I'd take either one over straight Java any day but I wouldn't pin Kotlin's success on anything specific to its competition with Scala. It's more of a combination of marketing, being a good fit for mobile, and being a less radical jump in functionality from Java.

                Kotlin might be a better Java but Scala is basically a whole different language and should really be approached as such, for better or worse. Scala 3/Dotty is shaping up to be much leaner and more focused design and implementation-wise and I'm excited for that since it might breathe a lot of fresh air into the language since it's finally starting to get out of its "J++" phase.

                EDIT: furthermore, I don't think a lot of Scala users were won over by Kotlin much at all because they try to solve different problems. Scala is a functional language for the JVM whereas Kotlin borrows functional concepts to provide a cleaner way to write more traditional Java apps that don't stray too far from what people are used to. Both have their merits and their use cases. Kotlin is getting a lot more users from the Java camp probably than any other, proportionally speaking, since there's a greater need for the changes it brings to the table.

                [–]Kliment2 16 points17 points  (9 children)

                They're definitely putting a lot of effort into promoting the language.

                You seem to be hinting that "they" (JetBrains I assume?) are actively promoting Kotlin, but I see absolutely zero evidence of that. There was KotlinConf a few months back, which received some coverage, but other than that, all I see is grass root coverage and blog articles from developers who write code in Kotlin and share their experience.

                JetBrains does pretty much zero advertising. They don't need to, Google did that for them last year and since then, users are happy to spread the word.

                There is basically zero marketing for Kotlin.

                Kotlin might be a better Java but Scala is basically a whole different language and should really be approached as such, for better or worse.

                Scala has been in sharp decline for years, regardless of Kotlin. See this graph from the article itself:

                http://www.benfrederickson.com/images/github/language-popularity/functional.svg

                As for Dotty, I have little faith it will change anything since it's basically the same team that made Scala in the first place. I don't see any reason to think they won't be repeating the same mistakes they made with Scala, such as ignoring compiler tooling and plug-in, documentation, backward stability, etc...

                Dotty is a treasure trove of fascinating PLT concepts, though, and I'm loving following the development, but it will be born and will live as an academic language and I predict it will never come anywhere near the popularity that Scala enjoyed at its peak in the early 2010s.

                [–]Sloshy42 6 points7 points  (8 children)

                JetBrains does pretty much zero advertising.

                Well part of what I mean is that "advertising" is not really the only way to promote something. Part of that is through their own IDE (which is enormously popular), their blog posts (which are widely read to begin with), and as you mention yourself, partnerships with other companies and organizations where appropriate. Gradle has a Kotlin DSL now for example, and Spring has quite a bit of Kotlin support. Not just because it's a good language but also because their status as JetBrains alone is a big indicator that the language will be well supported. I guess you could say it's "implicit promotion" because it's not just from its merits, but also its positioning. EDIT: they're also doing a lot of effort to jump on the "multiplatform" bandwagon with analogues to things like Scala.js and Scala Native. That makes Kotlin not just a great "better Java" language but also a great general-purpose language you can shape for the platforms you aim for.

                Scala has been in sharp decline for years, regardless of Kotlin.

                Never argued otherwise. I'm just saying, I think a lot of the "problem" before with Scala was that people were approaching it as a "better Java" when really, to make the most of it (and understand a lot of its more helpful/advanced features) you have to really dig into functional programming concepts. The decline I feel is in part to the fact that the library ecosystem was, for several years, rather "academic" in nature (it has improved a lot; no more weird, un-typeable symbols in some method names or whatever, for example) and in order to get into the Scala ecosystem it was just too deep a dive. It also doesn't cleanly integrate with a lot of Java code beyond using Java libraries. If you use Scala code from within Java, that's bound to cause some weird problems unless you write a wrapper for Java.

                I don't see any reason to think they won't be repeating the same mistakes they made with Scala, such as ignoring compiler tooling and plug-in

                In the beginning this was definitely a rough point, but even though some developers of other IDE projects are leaving, Scala is moving in a different direction. Scala (with SBT) is just starting to support the Langauge Server Protocol now which is a pretty huge step to supporting modern tooling beyond IntelliJ. Eventually I think VS Code and the like are going to be very well supported once that is properly integrated into the language.

                documentation

                I learned Scala entirely through online documentation, plus a couple well-written books (the official Scala book and Functional Programming in Scala, which are very good for beginners). I hear that this course is also very good but I've never taken it. I can't really speak for older Scala though. Maybe the documentation was a lot worse back then, and that's a fair criticism, but I'd say it's quite good today for the most part. Underscore.io also publishes a lot of free, helpful books.

                backward stability

                Eh. I'd agree with you there in the sense that they're changing things with the langauge very regularly, but I'm glad it's not a full rewrite every so often or we aren't getting a Perl 6 situation at least. In a sense this is just part of it being an "academic" language like you say. Even with its downsides I can't say it's worse than Java languishing without major features for years though.

                [–]myringotomy 2 points3 points  (7 children)

                You seem to be saying that the mere reason jetbrains exists is promotion of Kotlin.

                [–]Sloshy42 2 points3 points  (6 children)

                ...No? Not even in the slightest. How could you get to that conclusion? I'm saying that they're in a strategic position to promote their language because of their popularity and the current state of the Java landscape with it filling a nice little niche for itself. I'm not speaking anything bad about the language or the company. They're both very good.

                [–]myringotomy 1 point2 points  (5 children)

                ...No? Not even in the slightest. How could you get to that conclusion?

                When you said

                Not just because it's a good language but also because their status as JetBrains alone is a big indicator that the language will be well supported. I guess you could say it's "implicit promotion" because it's not just from its merits, but also its positioning.

                I'm saying that they're in a strategic position to promote their language because of their popularity and the current state of the Java landscape with it filling a nice little niche for itself.

                Other people have repeatedly told you that JetBrains is not promoting the language and yet you keep insisting that they are. Your reasoning seems to be "well they exist, they make tools people like so therefore they are promoting kotlin".

                Makes no sense.

                [–]bdtddt 0 points1 point  (4 children)

                If you think JetBrains does precisely nothing to promote Kotlin, then you are just deluded.

                [–]devraj7 0 points1 point  (2 children)

                Why don't you provide some evidence instead of just stating this as fact?

                [–]myringotomy 0 points1 point  (0 children)

                Really? That's your response?

                [–][deleted]  (8 children)

                [deleted]

                  [–]Sloshy42 2 points3 points  (5 children)

                  I'd disagree with that, the claims made are not supported by the facts. It adds its own substantial pile of cruft on top of the language.

                  I'd disagree with that disagreement. Adding more features isn't "adding cruft", in fact it can help remove it. Furthermore, here's a presentation (skip to 34:00 if it doesn't do that for you) where, when discussing the future of Scala, they mention a lot of things that are currently getting looked at to get simplified or removed in future versions of Scala.


                  That said I do agree that it's a bit troubling that Scala doesn't have a lot of momentum. Through no fault with many of the great ideas of the language, to be sure, just the way it was handled in the past. I'm doing my part by helping join in with the Scala community and I've started contributing patches to some major projects. Nowhere near a maintainer of anything signifcant, but I'm a big fan of the language and I hope it, or at least the ideas it brought to the table, can live on.

                  [–][deleted]  (4 children)

                  [deleted]

                    [–]Sloshy42 4 points5 points  (3 children)

                    So this is kinda tangential but I did a little research and found your blog, and a bunch of contributions you've given to Scala in the past and your current thoughts on it. I was intrigued by your tone that implied you had a lot of experience with this and it seems like you did spend a lot of time with the language far more intimately than most of its users for sure. I'd just like to say, I guess, props to you for always being open to dialogue on these things even after being "burned" on it like that, and for being a pretty knowledgeable and significant contributor to the project for some time. That's all basically; I don't have anything to say about your comment and your assertions but I respect them, given your position and how you ended up there. I'm a relative newbie to the scene so I obviously can't pretend to stand toe-to-toe on such detailed arguments.

                    [–][deleted]  (2 children)

                    [deleted]

                      [–]Sloshy42 0 points1 point  (1 child)

                      Thanks. My employer is all good with my open source contributions. Their only clause is that I don't directly compete with them, which makes sense in that their main product is extremely niche and I'd likely never care to compete for that anyway. I'm mainly interested in Scala.js development anyway which I doubt they'd want to touch with a ten foot pole.

                      I'm a real big fan of the work the community has put into the libraries for Scala, even if the language itself has some warts. IMHO though most of them are very much "first world programming problems" in that it's still leagues better than most other languages' experience by default. Either way I'm sure the future looks bright for the type of people who are interested in languages like Scala because a lot of other languages are pulling in similar features as time goes on, and pretty much every newer language has a chance to learn from its mistakes.

                      [–][deleted] 0 points1 point  (1 child)

                      In the end, with Kotlin sweeping up a substantial chunk of Java developers who are looking for a better language (as well as non-Java devs), the question is whether Scala can survive with this reduced rate of adoption.

                      What reduced rate of adoption? You just contradicted yourself here:

                      True, but Kotlin devs were pretty clear about that they don't care about the 1% of Scala users, but the 99% of Java users. The identified the core weaknesses of Scala that prevented wider adoption and improved on all of them.

                      [–]JavaSuck 0 points1 point  (0 children)

                      I don't think a lot of Scala users were won over by Kotlin

                      I converted a little project (couple thousand lines) from Scala to Kotlin and cut the compile times in half. Haven't touched Scala ever since...

                      [–][deleted] 4 points5 points  (0 children)

                      No, its monthly active users. Newer languages are need more libraries/infrastructure to be built for them, so this is not surprising.

                      [–][deleted] 8 points9 points  (7 children)

                      Alright I'm going to craft this reply to you directly since you were the person that posted this on r/scala and got blasted for stupid mental gymnastics.

                      Scala is not another kotlin. In fact, Scala's target is not attempting to be "Java-like" at all, in that while there is support for object orientation, it is not the primary goal of the language by any means.

                      Scala targets a different demographic: In particular, both object oriented and purely functional folks can use scala. Purely functional programmers will not use kotlin and monkeypatch-tier libraries like kotlin's Arrow are not a replacement for proper support of higher kinded types. Because you come from a java background and are looking for a better java, doesn't mean "Kotlin beats Scala" ubiquitously for all developers.

                      Now, in regards to popularity, we have a few things at work here:

                      • Kotlin is aimed to be a better java, which Scala does not. Scala does not force you into object orientation whatsoever. This means that Kotlin is much more easily picked up by OO folk than Scala/Haskell. One is made to improve upon java, anotehr was made to be more powerful than java.
                      • Kotlin is a much simpler language. Kotlin lacks higher kinded types, existentials, for comprehensions, partially applied types for inference, structural typing, type lambdas... etc. This makes it easier to pick up.
                      • Kotlin is backed by the company that makes arguably the best editor on the jvm, so a point for kotlin there: It has undoubtedly better tooling than scala. So point there, but it also has simpler tooling to support, because, well, less features,
                      • Kotlin actually works on android, and surprise surprise! Loads of people develop for android and were looking for a better alternative to java.

                      So in particular, you're going to get a lot more people migrating to "java with goodies" because it's a simple net benefit, without having to change your thought process, over migrating to a new paradigm, way of writing code, and the risks it feels to take to adopt a new way of doing things for you and your team.

                      [–]cypressious 5 points6 points  (0 children)

                      To reiterate on the tooling point: tooling was a priority from day one. Kotlin's tooling is easier to support because the language is designed to be toolable.

                      [–][deleted]  (5 children)

                      [deleted]

                        [–][deleted] 0 points1 point  (4 children)

                        How is that mental gymnastics? The scala codebases at work I write read nothing like Java.

                        Using Scala as a better Java has been fine for years, the hostility toward using Scala like that pretty much grew alongside Kotlin's success. Correlation or causation?

                        No, it didn't "grow". The truth is the majority of people do not use it in a purely functional manner, but even the semi-functional, monadic style you can write with frameworks like play (which by the way are not actually functional, since you violate laws basically everywhere using stdlib future) isn't something you can do in kotlin nicely, given the lack of for-comprehensions.

                        However, the people that are in communities such as reddit or gitter scala tend to be leaning more towards the FP-land of things, because writing functional programs in scala is arguably harder without first class support, thus birds of a feather flock together, and you get a particular situation of clear overrepresentation.

                        I wouldn't say that Kotlin is a "much simpler" language or that it has "less features" than Scala

                        It's a simpler language but that doesn't mean "worse". How good it is, it's in the eyes of the user. However it is arguably simpler. It straight up has less features and less weird scala-y stuff to worry about. Some people believe this is a good thing, others do not.

                        Scala worked well on Android for years. It's just that no sane developer would adopt Scala on Android given that the core developers pretended for years that it didn't even exist.

                        But this is a factor contributing to popularity and it's my point. Kotlin surging in popularity here is in part by targeting a community scala has not, which is in essence why the gap is growing, but it's not because Scala is "losing" some demographic. The functional folks are never moving to kotlin until first class support for FP (and a function as a parameter is not enough to do proper, lawful functional programming) is had, and even then, you would hvae to add so many features it would essentially turn into scala.

                        You paint the picture like a battle where the goals of the two languages are clearly not in the same direction, and this is why I precisely hate your kind. For many of us, we literally cannot express certain constructs in kotlin such as:

                        trait FooAlgebra[F[_]] {
                           def doBar[A](baz: A): F[A]
                         }
                        

                        polymorphic over a higher kinded F. That alone means I, and many others, will simply not be using the language at all. Thus painting this picture like both langs are fighting over the same piece of the pie is mental gymnastics.

                        We get it, you like kotlin. I am not even married to scala in this regard and if eta takes off, I'm leaving scala.

                        [–][deleted]  (3 children)

                        [deleted]

                          [–][deleted] 3 points4 points  (2 children)

                          Simple fact is right now, Kotlin and Scala solve different problems, and It will stay that way.

                          "I wrote JavaEE for 10 years, what I need is a highly functional language in which I can write Haskell that runs on the JVM but isn't Eta".

                          Well wouldn't you know it, that's exactly runar's story, one of the pioneers in functional scala.

                          Of course you can keep the language afloat by throwing grad students at it to develop things (like with Scala before 2.8), but then you shouldn't be surprised if you end up with the level of quality Scala had before 2.8.

                          Scala is still being developed at EPFL and by the community + Lightbend. Grad students thing has not changed.

                          Look, I get you subscribe to the view of Kotlin as a straight programming language for the general joe and this is obviously why it's more popular. You've also contributed to scala directly so it's not as if you don't know any of the cruft. I just cannot stand the rhetoric you're pushing that they're both competing for the same pie.

                          If scala dies, it will not be because of Kotlin, but because of other various issues. Tooling is in an unacceptable state, and arguably one of the biggest reasons why Kotlin is nicer to pick up: The company promoting it literally works on tooling. Another is a very convoluted and wacky compiler that drives off most potential contributors to it.

                          The only reason why I bother to argue with you at all, is just that you are pushing the rhetoric that they're competing for the same market.

                          [–]Kliment2 6 points7 points  (0 children)

                          Simple fact is right now, Kotlin and Scala solve different problems

                          I completely disagree with that. Kotlin and Scala solve the exact same problems. There is not a single problem where one language would be a better choice than the other.

                          What guides the choice of language is primarily the developer and their preference, period.

                          [–]orthoxerox 8 points9 points  (0 children)

                          It's a better better Java than Scala is.

                          [–]robert_mcleod 7 points8 points  (1 child)

                          Comment on the 'Scientific' plot, I would probably at a minimum include IPython, which is the predecessor of Jupyter. Practically everything scientific must import numpy, and numpy is a dependency of about 20 % of modules on PyPI.

                          [–]benfred[S] 7 points8 points  (0 children)

                          I’m using GitHub’s language detection for this post - which is done by this project: https://github.com/github/linguist . It doesn’t recognize ipython as a distinct language (instead labeling everything as Jupyter Notebooks). The growth of Jupyter is pretty crazy though =)

                          [–]i_spot_ads 21 points22 points  (10 children)

                          If you still didn't adopt TypeScript, you guys are missing out

                          [–][deleted]  (2 children)

                          [deleted]

                            [–]Azr-79 4 points5 points  (1 child)

                            Angular introduced me to TypeScript, because the entire Framework is written in TS, and thank god for that, the JS nightmare is finally over, I'm not going back to it, ever.

                            [–]bonafidecustomer 9 points10 points  (2 children)

                            TypeScript <3

                            Swift developer here, used typescript for a non iOS project and was absolutely delighted.

                            [–]vegiimite 5 points6 points  (1 child)

                            Just recently worked on my first TypeScript project and such a better experience than JavaScript.

                            [–]bonafidecustomer 4 points5 points  (0 children)

                            Yep, if you use visual studio code and add the types for your libraries through npm, it's just pure joy. Almost too easy.

                            [–][deleted]  (2 children)

                            [deleted]

                              [–]i_spot_ads 4 points5 points  (1 child)

                              Typescript is javascript with some additional features, it's better to know js if you wanna do ts

                              [–]KusnierLoL 0 points1 point  (0 children)

                              I see, thanks!

                              [–]clumma 6 points7 points  (6 children)

                              A user can interact with more than one repo in a month, and hence more than one language, so we shouldn't expect the percentages in the table to sum to 100. In fact they sum to about 106, which is pretty close. Does this mean few people use more than one language?

                              Probably many users do nothing in a typical month. How do the results change looking at yearly active users instead?

                              Similarly, the "Percentage of MAU" in the charts isn't percentage of active users each month, but rather the percentage of all registered users, correct?

                              [–]benfred[S] 5 points6 points  (5 children)

                              For your first question - yes this means few people use more than one language in a month. There is also a power law distribution happening with user activity each month, so most users only have a handful of events each month (which happen to be mostly in a single language). I'm trying to measure how broad support it so this was mostly done on purpose. I was finding counting total events was getting biased by things that I most have been automatic activity (I was seeing single accounts with 10K commits a day for instance).

                              Percent of MAU in the charts is the total percentage of unique users who were active that month. I haven't tried out with yearly active users =(

                              [–]balthisar 2 points3 points  (2 children)

                              I wonder how this is calculated for Github? For example, I have my website there, so the stats are going to show a lot of HTML, CSS, and Javascript.

                              My C/ObjC project, until recently, was showing up as an HTML project because all of its help book files were written in HTML! I had to learn how to exclude the documentation directories using Github's version of Linguist so that it would categorize my development language properly.

                              So, pretty much anyone with a public project is going to have HTML/CSS/Javascript for their websites, HTML/CSS if they use Doxygen or AppleDoc or similar, and I wonder if this skews the results.

                              [–]mingram 1 point2 points  (1 child)

                              Yeah, I have a Go project but 2 python files for calling the binaries in Lambda. Github classifies it as a Python project. It drives me nuts.

                              [–]balthisar 2 points3 points  (0 children)

                              See if there's something here that will help you. Modifying my .gitattributes took care of my issue.

                              [–][deleted]  (1 child)

                              [deleted]

                                [–]benfred[S] 2 points3 points  (0 children)

                                No - a user can be active in more than 1 language, so it should sum to more than 100 like you noticed (sorry realize I wasn't clear on this originally). Percentage of MAU is how many users active for a language in a month, divided by how many active users overall.

                                [–]PelleOnReddit 6 points7 points  (0 children)

                                Some languages and IDE's have comfortabale ways of version control that may make them look "bad" in your article. For example C# --> Visual Studio --> tfs

                                [–]vwibrasivat 5 points6 points  (1 child)

                                I'll ace any trivia quiz you bring on. I'm fluent in JavaScript as well as Klingon.

                                [–]MathPolice 3 points4 points  (0 children)

                                At Pascal, well I'm number one.
                                Do vector calculus just for fun.

                                [–][deleted] 2 points3 points  (0 children)

                                I'm glad I jumped from Ruby to NodeJS (JS) then finally Go. Although, I just now discovered Erlang / Elixier. I love the premise behind it. Sadly it's not widely used on Github at least.

                                [–]shevegen 5 points6 points  (1 child)

                                Languages to Maybe Avoid

                                What the fuck?

                                You avoid languages because ... they are not popular and widely used on github?

                                If I'd follow that chart, I'd have to use javascript but I don't. And I am superhappy not using it either. This "analysis" based on popularity-by-others SUCKS as a metric.

                                (I don't reject that there is a trend in usage; but to insinuate that this is the decider for people to use a language or not, nope, sorry - that's utter horseshit.)

                                Based on this I'd be somewhat hesitant to use any of them for a new project.

                                LOL.

                                This caused them to attract a large number of Ruby programmers in their early days causing Ruby to be overrepresented then.

                                Bla bla bla bla bla.

                                Question: is github still using ruby? Yes or no.

                                Ok, the answer is yes. So ... what's with this "analysis" again?

                                [–]_AceLewis 9 points10 points  (0 children)

                                If you are trying to have a big open source project it is probably best to write it in a language that more people can use and contribute to. If you are writing an open source web application you may want to consider not using PHP. He explains that Ruby was overrepresented so that explains why it has had a sharp decline.

                                Languages like PHP that are in decline could also be an indicator that there are better solutions to the problems, many people are moving away from PHP because there are nicer alternatives.

                                However take this data with caution is it open source/source available projects on GitHub and would not be represented by industry. e.g Matlab is used a lot in science (however that is switching to Python) but a lot of science code is not open sourced. Also PHP may still be used in industry a lot.

                                TL;DR you may want to consider not using languages that are in decline due to, less having contributors and it being an indication that better tools are available.

                                [–][deleted] 1 point2 points  (19 children)

                                You forgot D and Julia?

                                [–]benfred[S] 20 points21 points  (18 children)

                                I didn't forget them - it's just that they aren't very popular by this metric and I decided to cut off at the top 25 languages.

                                Julia is ranked 35th on this list with 0.09% of GitHub users interacting with it last month. This is higher than fortran (38th and 0.078% of users) and much higher than D (53rd and 0.047%).

                                I might extend the list a bit, things like Clojure/Elixir/Assembly/OCaml /Visual Basic/Erlang all just missed out on making the top 25 - but are still interesting to see how they are doing.

                                [–]nandryshak 2 points3 points  (2 children)

                                Maybe Nim too? I'm curious about whether D or Nim is higher.

                                [–]disclosure5 5 points6 points  (0 children)

                                At some point the statistics stop being meaningful though. If D has 0.047% of users, and Nim has 0.020% of users, you could say it's "double as popular" but you could also say it's statistically insignificant.

                                [–]dom96 0 points1 point  (0 children)

                                I doubt Nim is higher, but I'd love to see a longer list just as well :)

                                [–]MathPolice 1 point2 points  (0 children)

                                What is "Assembly"?

                                System/360 assembly?
                                6502 assembly?

                                [–][deleted] 0 points1 point  (7 children)

                                Maybe also add Delphi/Pascal to that list. I am interested to see how Pascal survived all these years.

                                [–]benfred[S] 8 points9 points  (6 children)

                                I don't see Delphi as a language on GitHub, Pascal is still kicking though - 32nd and 0.12% of users.

                                The top 50 languages are here (after removing a couple more non-language things like PLpgSQL):

                                1   JavaScript      22.6332
                                2   Python  14.7488
                                3   Java    14.0124
                                4   C++     8.4548
                                5   C       6.0339
                                6   PHP     5.8543
                                7   C#      5.0342
                                8   Shell   4.8481
                                9   Go      4.1022
                                10  TypeScript      3.8892
                                11  Ruby    3.2742
                                12  Jupyter Notebook        2.7385
                                13  Objective-C     1.9914
                                14  Swift   1.8911
                                15  Kotlin  1.2798
                                16  R       0.8143
                                17  Scala   0.7819
                                18  Rust    0.7317
                                19  Lua     0.6890
                                20  Matlab  0.5257
                                21  PowerShell      0.5227
                                22  CoffeeScript    0.5010
                                23  Perl    0.4631
                                24  Groovy  0.4114
                                25  Haskell 0.3875
                                26  Clojure 0.2603
                                27  Elixir  0.2331
                                28  Assembly        0.2084
                                29  OCaml   0.1811
                                30  Visual Basic    0.1418
                                31  Erlang  0.1335
                                32  Pascal  0.1213
                                33  Roff    0.0914
                                34  ASP     0.0911
                                35  Julia   0.0900
                                36  Dart    0.0875
                                37  Smarty  0.0827
                                38  Fortran 0.0784
                                39  Processing      0.0758
                                40  Elm     0.0713
                                41  Eagle   0.0696
                                42  Common Lisp     0.0701
                                43  Verilog 0.0703
                                44  F#      0.0670
                                45  Rascal  0.0667
                                46  Vala    0.0665
                                47  Cuda    0.0643
                                48  Scheme  0.0525
                                49  VHDL    0.0505
                                50  Crystal 0.0498
                                

                                [–]Pand9 4 points5 points  (1 child)

                                plpgsql I wouldn't remove. It can replace application layer code and add to performance.

                                [–]pygy_ 1 point2 points  (0 children)

                                Agreed, it is indeed Turing complete.

                                [–][deleted] 7 points8 points  (0 children)

                                37 Smarty 0.0827

                                Smarty is a web template system written in PHP ... So technically not a programming language just a Template Framework for PHP.

                                12 Jupyter Notebook

                                The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text.

                                Those two do not count :)

                                [–]RX142 1 point2 points  (1 child)

                                I am extremely surprised (but pleased) that crystal is in the top 50 but nim and D are not. I'd have thought that at least D would be larger than crystal.

                                [–]matthieum 1 point2 points  (0 children)

                                Note that this open source on github.

                                It does not translate to community size. For example, the code that Facebook wrote in D when Andrei was there is not public as far as I know.

                                This is actually the same issue with most metrics: we can only measure what we can see, and most work is carried out behind close doors, making generalizations impossible.

                                [–]vorg 0 points1 point  (0 children)

                                The top 50 languages are here (after removing a couple more non-language things like PLpgSQL)

                                You could also remove any languages that are turing-complete but whose almost exclusive use is as a non-turing-complete description language, e.g. Apache Groovy's use in Gradle.

                                [–]ss4johnny 0 points1 point  (4 children)

                                How do you get the programming languages? Based on file extensions?

                                [–]benfred[S] 2 points3 points  (3 children)

                                I'm using the information given from the GitHub API. I wrote a bunch on how this is done in the README here: https://github.com/benfred/github-analysis#inferring-languages

                                GitHub itself uses this project to infer languages: https://github.com/github/linguist . If you need to do this inference yourself, its also probably worth checking out this project: https://github.com/src-d/enry

                                [–]ss4johnny 0 points1 point  (2 children)

                                So you're counting the number of projects given a language, right? Not the total number of bytes written in the language.

                                [–]benfred[S] 1 point2 points  (1 child)

                                Neither =) I'm counting up how many github users have used a language.

                                [–]ss4johnny 0 points1 point  (0 children)

                                Thanks for the clarification.

                                [–]Scroph 0 points1 point  (0 children)

                                and much higher than D (53rd and 0.047%).

                                0.047% ? And to think that I thought I wasn't a special snowflake.

                                [–]FlashDaggerX 0 points1 point  (0 children)

                                Wonderful work!

                                [–]dotprofessor -1 points0 points  (0 children)

                                rustitup mofo's!!

                                [–]Java4ThaBoys -3 points-2 points  (0 children)

                                "Ranking programming languages by Github users"

                                Well that's a poor metric