I’ve been programming for decades, though usually for myself, not as a profession. My current go-to language is Python, but I’m thinking of learning either Swift (I’m currently on the Apple ecosystem), or Rust. Which one do you think will be the best in terms of machine learning support in a couple of years and how easy is it to build MacOS/ iOS apps on Rust?

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

    Something to consider as well is learning both. Swift is certainly the best choice for making macOS/iOS GUIs. Other languages are probably better than Swift for your ML needs (could be rust, Python, etc.). However it’s totally possible to have an app using multiple languages. You could have the UI portion be in Swift, but the ML portions be in another language.

    At my company we have a Mac app with the GUI written in Swift, shared logic with our Windows app written in C++, and some libraries written in Rust. So it’s certainly possible.

    One caveat is that some languages don’t work with each other very well. Swift and Python do work well together iirc, so doing UI code in Swift and ML code in Python may not be a bad idea.

    If you want to just stick to Swift, Apple does have some ML frameworks for Swift that you can use. I don’t do any work with ML, so I have no idea if these frameworks are any good, or have good resources for learning.

    If you want to just stick with whatever language you use for ML, there are GUI libraries in nearly every language. These certainly won’t be as robust or as nice to work with as the native frameworks in Swift, but they could probably get the job done. I do know that a major issue with GUIs in Python is the difficulty in multi threading, which is a must for any app that performs long tasks without the UI freezing.

    • philm@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Just learn whatever you currently need. If you know a few paradigms, learning a new language of the same paradigm is easy-peasy and can be done rather quickly (well at least being be productive with it, doing stuff idiomatically often takes a little bit longer).

      That said, Rust IMO is a language that makes sense to learn anyway, since it also teaches you to program in a nicer way (not just true for Rust, there are other languages that have this effect as well, such as Haskell etc. generally languages that introduce something really new (i.e. a new paradigm)). Generally it makes sense to learn multiple languages, as each brings you new ideas. But on the other hand it makes sense to learn one language really well (I’d recommend that being Rust, as it can cover so many use-cases and is generally designed nicely (it fills a sweet spot between mutability and functional programming IMHO).