• Lambda@lemmy.ca
    link
    fedilink
    English
    arrow-up
    48
    arrow-down
    2
    ·
    1 year ago

    After years, and many languages, I still have to say Ada. Kotlin, Rust, Julia, and Nim are my current contenders to overtake, but here’s what Ada does well enough to still be my preferred tool when appropriate:

    • strictness: typically my code works the first time it successfully compiles with few or no bugs. Rust is almost on par in this respect.
    • structure: a corollary of the above is that it forces me to “plan ahead” more than just “start coding” which I find fits my programming style better, and leads to better “Unix Philosophy” product designs. I haven’t found any other language that has the same effect other than maybe Haskell.
    • speed: I honestly find that Ada code outperforms C/C++ code most of the time. The only times C/C++ outperform Ada is after optimizations that come at the cost of readability.
    • multitasking: Ada’s first-class tasks and protected objects are the only way I’ve ever been able to write bug-free concurrent programs that are more complex than async/await and/or producer/consumer structures (and I took a dedicated elective on concurrency at university!). Kotlin is almost on par in this respect with its coroutines.
    • hardware: The fact that Ada basically ships with a hard real-time OS built-in and can compile to e.g. AVR means that all my fancy libraries I’ve written or saved work just as well for a desktop game, a website backend, or an embedded microprocessor. Just look into representation clauses and interrupt pragmas to see its unique powers.
    • design: The whole design of the language has lead it to be the only language where I can consistently return to a multiple year old passion project with no attempt to write maintainable code, and fully understand what its doing and modify it with little effort.
    • tooling: While this is the biggest downside of Ada (see below) gprbuild is still my favourite build tool. I have no idea why strongly-typed build systems aren’t more common. Its always a joy to work in gprbuild, once you get gprbuild working of course.
    • static polymorphism: Ada’s generics are some of the best I’ve found. But they have some limitations that leads us into…

    There are some situation where Ada shows its age:

    • static calculation: I love Nim (and Zig, etc) for the ability to run arbitrary code at compile time. It allows me to describe what would normally be an opaquely initialized data structure or code path in a clear and descriptive manner.
    • terseness: Ada is verbose, that’s not such a big deal, but I find its just a tad too verbose which can lead to some slight difficulty when parsing code. func/proc (Nim) vs fun (Kotlin) vs fn (Rust) doesn’t make much difference to me, but function X returns Y/procedure X starts to add a lot of visual noise to a file.
    • web compilation: The ability for both Kotlin and Nim to compile to either ASM or JS is AWESOME. If I have to write a “full stack” application, Kotlin multiplatform with ktor every day.
    • operator overloading: Only the built-in operators can be overloaded in Ada. It always makes me wish I could overload arbitrary operators. A small thing, but a symptom of…
    • TOOLING: Ada’s tooling is BY FAR the hardest I have ever seen to get working. It takes the “eat your own dog food” too far. The fact that even in Arch Linux you have to install a bootstrap package, then the real package shows how hard it is to get a consistent build environment. ALR is helping in this respect, but is still not quite mature in my opinion.

    Here’s when I use the alternatives, and their biggest weaknesses:

    • Kotlin: anything where I want both one or more JS artifacts and one or more JVM/native artifacts. Weaknesses: performance, static analysis, on the fence about tooling (gradle is cool, but sometimes seems too over-engineered), Biggest weakness: IDE dependency, writing Kotlin outside of IntelliJ is a pain, which is somewhat fair given who maintains it!
    • Rust: so close to beating Ada, if not for two things: ugly code - so many operators and glyphs that pollute the reading experience, maybe I’ll get used to it eventually, but for now I can’t scan Rust code, nor pick up and revisit it nearly as easily as Ada; language scale - I find Rust suffers from the C++ design attitude of “we can add this as a language feature” it takes too much mental effort to hold the entire design of the language in your head, which you sort-of have to do to develop software. Java and C are IMHO the undisputed kings in this respect. After reading through the specifications of both languages, neither will ever have any surprises in store for you. There’s no magic under the hood or special case. All the cool features are done by libraries and rely on the same simple syntax. Every time I learn a new cool thing Rust can do, its at the expense of another edge case in the compiler that modifies my conceptual model of the code.
    • Julia: multiple dispatch and mathematics plus clean module design and easy unicode incorporation leads to clean code for math-y/science-y code.
    • Nim: templates and macros are excellent, concept system gives access to Rust-style traits without all of the additional “ugliness” of Rust, excellent performance, tiny executables. I just find that the syntax can get clunky. The UFCS easily cleans up a lot of the mess that Rust creates with its added features, since it keeps the parsing the same even when using some fancy language feature.

    Thank you for attending my TED talk :P. Any questions?

    • Crackhappy@lemmy.world
      link
      fedilink
      English
      arrow-up
      14
      ·
      1 year ago

      That’s a great opinion piece you’ve written there. You could with a little editing and restructuring turn it into an article.

    • Fried_out_Kombi@lemmy.world
      link
      fedilink
      English
      arrow-up
      9
      ·
      1 year ago

      I’ve never used Ada (I’ve heard great things, though), and I’ve only used Rust and Kotlin a little bit, but I can at least vouch that Julia and Nim are both supremely lovely languages.

    • Scorchio@lemm.ee
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      I learned Ada in the early 90s before being plunged into a world of C/C++. I haven’t heard much about it since, but I’m glad to hear it’s alive and kicking. I’ll have to have another look, see if I recognize any of it!

    • Subverb@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I’m an embedded systems C programmer with passing familiarity with Python. To me it seems ridiculous that a language relies on whitespace for blocking. Is that true?

      • Kacarott@feddit.de
        link
        fedilink
        English
        arrow-up
        8
        ·
        1 year ago

        It only requires consistent indentation inside blocks, which is what any good code does anyway for readability. So the main difference then is just that you no longer need the redundant curly braces.

      • esscew@lemmy.ml
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        1 year ago

        Yes, unfortunately. There is a lot of tooling around it but it still feels bizarre after years of using it.

        • Subverb@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          I’m anal about curly braces in C. I never code without them because I don’t like being ambiguous.

          I never do

          if(i=0) return 0;

          or worse

          if(i=0) return 0;

          I do

          if(i=0) { return(0); }

    • cocobean@bookwormstory.social
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      I had to use Python for a bit at work and it was confusing

      pipenv, venv, virtualenv, poetry…wtf is all this shit

      a.b vs a['b'] vs a.get('b')…wtf is a KeyError

      • RichieAdler 🇦🇷@lemmy.myserv.one
        link
        fedilink
        English
        arrow-up
        5
        ·
        1 year ago

        What happens in other languages you use when you try to access a non-existing key for a hash/map/dict?

        What language do you use that accessing an object attribute is the same that accessing a dict key?

        What knowledge do you have (or not) that KeyError is a mistery to you?

      • mim@lemmy.sdf.org
        link
        fedilink
        arrow-up
        11
        arrow-down
        1
        ·
        edit-2
        1 year ago

        By versatility, I’m also including the ecosystem. Julia doesn’t seem to be anywhere near python on that.

        However, I’ve heard good things, it’s on my to-do list.

  • colonial@lemmy.world
    link
    fedilink
    arrow-up
    36
    ·
    edit-2
    1 year ago

    I’m a big fan of Rust.

    • Excellent tooling. The package/build manager (cargo) just works, the compiler’s error messaging is simply unmatched and the IDE story is excellent thanks to rust-analyzer.
    • Rich ecosystem. There’s a crate for almost anything you could need, and endless piles of learning resources.
    • You get the speed and low-level control (if necessary) of C/C++ without all the pain and legacy baggage.
    • The community tends to care a lot about correctness and API design, which is reflected in both the core language and the ecosystem. Rust doesn’t try to hide complexity and pretend things are simple (like Go) - instead, it gives you the tools to manage it head-on.
      • Example: if a function can fail, then it returns a Result and you have to explicitly handle the possibility that something went wrong. There’s no forgetting a null check and slamming face-first into a NullReferenceException or segfault in some other part of your code.
    • It’s expressive. Iterators, generics/traits and other language features make it easy to communicate what’s going on to both the machine and other humans. Even the syntax is designed to support this - you can tell a lot just by looking at a function signature.

    Obviously it’s not all perfect, however.

    • Compile times can drag you down. (rustc is always getting faster, of course, but it’ll probably never be as fast as Go or JVM/NET.)
    • It can be difficult to read at times, especially when code starts leaning heavily into generics and lifetime annotations.
    • Speed and control comes at a cost. No garbage collector means that anyone coming from a managed language (which, hello, that was me) is going to have to rewire their brain to deal with lifetimes, ownership and mutability XOR aliasing. You eventually develop an intuition for how to structure your code to play nice with the compiler, but that takes time.
    • New language features can take a long time to be stabilized and released. The advantage is they tend to be baked all the way through from day one, but the slow pace can be infuriating, especially when big ecosystem advancements are hung up on key additions.
    • ProtonBadger@lemmy.ca
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      1 year ago

      And much time is saved from debugging. It makes a lot of sense that we let the computer/compiler keep an eye on lifetimes, allocations and access so the code is much more correct once it compiles.

      I feel like my old colleagues and I have spent a far too large part of the last 20 years chasing memory issues in C++. We are all fallible, let the compiler do more.

    • floofloof@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 year ago

      I like the way the compiler doesn’t just tell you there’s a problem, but also gives you advice on ways you may be able to fix it. That’s a smart compiler.

      And I like the way I can write something that runs fast but not feel faintly anxious all the time I’m doing it.

  • httpjames@sh.itjust.works
    link
    fedilink
    arrow-up
    23
    arrow-down
    1
    ·
    1 year ago

    Go. It’s high level enough in terms of syntax that it’s easy to build complex apps in, and low level enough that I’m able to control pointers, manually run the garbage collector, and benefit from the runtime performance.

    It’s the best of python and JS.

  • darcy@sh.itjust.works
    link
    fedilink
    arrow-up
    20
    ·
    1 year ago

    rust thank you for asking

    crab army attack! 🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀🦀

    • pfc@lemmy.ml
      link
      fedilink
      arrow-up
      4
      arrow-down
      1
      ·
      1 year ago

      rust is really great but rust foundation’s mistakes kinda killing it :/

        • pfc@lemmy.ml
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          I agree. :) I kinda marked “bad decisions to screw community” thingy.

      • colonial@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        I think the stuff with the foundation is kinda overblown by the Internet drama machine. That’s not to say they haven’t made mistakes, but hopefully the leadership council will fix things up.

        Plus, Rust has come into widespread use, so it’ll be very hard to kill.

        • pfc@lemmy.ml
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Ah, I do not think it’s really overblown… It’s really a mistake that needs to be fixed up and people screaming to let them know. That is what we should do and it is great!

          Agree by the way, its really hard to kill but i think can be killed if same mistakes happens over and over. Rust is an awesome language, I do not want foundation to overrun it. We should be talking about awesome crates, not an idiot decision made by foundation…

  • Kissaki@feddit.de
    link
    fedilink
    English
    arrow-up
    19
    ·
    1 year ago

    C#. Strong core, a lot of convenience extensions, extensive ecosystem, great docs, great IDE (VS) with suggestions, refacs, lingers, etc.

    • Scorchio@lemm.ee
      link
      fedilink
      arrow-up
      10
      ·
      1 year ago

      C# is still my favorite. I’ve been pushed back into a C++ project recently and it’s just painful.

      • superfes@lemmy.world
        link
        fedilink
        arrow-up
        5
        arrow-down
        2
        ·
        1 year ago

        I live on the C++ side and I find C# painful, I think it’s just a matter of familiarity.

  • M-Reimer@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    edit-2
    1 year ago

    Python. Works for nearly everything I need. I mostly write small helper tools (most of them shared under a FOSS license) and for my job, I developed a backend API server which sits behind a web application. I also use Python for scientific math stuff as nearly every Matlab also exists for Python.

    I did use Perl a lot before but in my opinion Python took over the role of Perl. I loved Perl for having a module for just about everything but nowadays most Perl modules are unmaintained and you find the “good stuff” for Python.

  • alokir@lemmy.world
    link
    fedilink
    arrow-up
    16
    ·
    1 year ago

    Typescript with all strict checks turned on. You get all the good parts of JS with types, and (almost) none of the bad ones.

    It’s quite an expressive language with tons of quality of life features that I constantly miss from other languages.

    • 9point6@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      1 year ago

      Honestly for web/backend dev in 2023: Typescript for 90% of things, Go or Rust for anything else that needs to eek out that extra bit of performance.

      I occasionally write the odd bash script, but really that’s just a novelty way to mix things up half the time

  • XPost3000@lemmy.ml
    link
    fedilink
    arrow-up
    17
    arrow-down
    1
    ·
    1 year ago

    Python

    It’s real easy to just launch it and get a script going, no need to wait for and ide or a compiler, there’s alot of nice modules, and it’s really API friendly

    I’ve spent more time in the blender python API than I’d like to admit

  • Jeena@jemmy.jeena.net
    link
    fedilink
    arrow-up
    14
    ·
    1 year ago

    Haskel, It’s kind of hard to do some stuff which are easy in other languages but if you find a good problem to solve with it, it’s amazing how expressive you can be and how short your code gets compared to all the boilerplate code you have to write with other languages.

  • TheTeej107@lemmy.world
    link
    fedilink
    English
    arrow-up
    13
    ·
    1 year ago

    Kotlin. I like how versatile its features can be and how much more it adds compared to Java. I also think it’s cool how Kotlin can be used to write native apps and web apps too.

    I would like to learn Rust. I heard nothing but good things about it. I however don’t have the need or enough motivation to do so.

  • HakFoo@lemmy.sdf.org
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    1 year ago

    PHP.

    It picked a niche and fits exactly into it. It’s a language for server side web pages. It’s not a general purpose language shoehorned into the task, so it wisely sets boundaries. PHP could avoid a lot of async/await/promise hell because you can work in the mindset of HTTP requests-- terms of short lived requests that are compiled elsewhere. You don’t have fragile runtime environments (see: server-side JS), since it just plugs into Apache or Nginx, which are at least battle tested and known quantities to operate.

    It’s batteries included. Hell, it’s the entire Duracell company included. The standard library is rich and centrally documented, including decades of community nitpicks, even before you go into composer repos.

    It’s non judgmental. You can write procedural code, or object-oriented code, based on preference and fit to task.

    It makes ad-hoc easy and formal possible-- If I need an array of [227, “Steve” => “meow”, 953 => new FreightLocomotive()] I can get it, or I can enforce types where it’s relevant and mitigates risk.

    • saloe@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      PHP really is such a forgiving language and easy to understand and get in to. My favorite part is that every time I have a seemingly very niche and specific use-case, there is a function that just does that thing perfectly and is already included in the base library.

      You said it and I’ll reaffirm: the documentation and online library of SO questions/answers is absolutely priceless. Most of the older versions are still compatible with the latest version, so upgrading is simple and usually just means there are more features you can use now.

  • stillitcomes@lemm.ee
    link
    fedilink
    English
    arrow-up
    15
    arrow-down
    2
    ·
    1 year ago

    Python. It’s the only one I know :(

    I’ve been trying to learn C# too but object-oriented programming just slides right off my smooth brain lol.

    • Kache@lemmy.one
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      object-oriented programming just slides right off my smooth brain lol

      Don’t worry, although it’s good to learn, IMO it’s still on the wrong side of overused and overrated and could stand to be applied more selectively than it tends to be.

    • Polpota@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      Been learning python for selenium and I love it. I know some C# and Javascript but I enjoy Python a lot more as a newb.

    • Venat0r@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      Nothings stopping you from writing object oriented code in python too, or function oriented code in C#.