Slashdot Mirror


Google May Adopt Apple's Swift Programming Language For Android, Says Report (thenextweb.com)

An anonymous reader writes: Google has plans to make Apple's Swift object-oriented language a "first-class" language for Android, reports The Next Web. The publication, citing sources, adds that Google doesn't mean to replace the current first-class language for Android -- Java -- at least, "initially." Google sees an "upside" in using Swift, which Apple made open source last year. But a ton of things need to fall into place for this to work. From the report, "All told, Google would have to effectively recreate its efforts with Java -- for Swift. If the company is motivated enough, it's very possible to do so without compromising on its open source values or ruffling any developer feathers along the way." The company is also discussing internally about making Kotlin as a first-class language for Android. "Unlike Swift, Kotlin works with Android Studio, Google's IDE for Android development. Unfortunately, sources tell The Next Web that Google's current mindset is that Kotlin is a bit too slow when compiling."

8 of 172 comments (clear)

  1. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by Jeremi · · Score: 4, Insightful

    Damn it Google, just pick a fucking language already and make it an option as an alternate to Javascript on the browser.

    I thought the trick for web browsers was to pick your own favorite fucking language, and compile it to JavaScript for deployment? Then every programmer can use whatever language he/she prefers, rather than everybody having to use the same language.

    Of course, this article isn't about web browsers, it's about application development.

    --


    I don't care if it's 90,000 hectares. That lake was not my doing.
  2. Not JVM by Anonymous Coward · · Score: 5, Informative

    I hope they don't intend to run Swift on their JVM.

    What makes Swift so performant is that it lacks a tracing garbage collection. It only uses reference counting. Reference counting is a kind of garbage collection, but it doesn't by itself detect cycles. It's the cycle detection that is costly in languages like Java or Python (which uses reference counting along with a tracing collector for cycles.) People argue that cycle detection is cheap, especially in generational GCs. But the generational assumption presumes too much. Likewise when passing references between threads. Cross-generational (yet temporary) and cross-thread value passing can happen often. (See, e.g., MoarVMs problems.)

    Plus, tracing collectors often need 2x RAM to be performant. Again, people wave away that requirement by arguing RAM is cheap and plentiful. But that assumption is broken all too often, as well, _especially_ on embedded devices.

    So Swift offers both lower latency, more consistent latency, and requires fewer CPU and RAM resources. The cost is that you have manually break cycles, otherwise you'll leak memory. But tracing collectors don't fix all leaks, either. It's common to "leak" memory through caches. Some languages provide ephemerons (e.g. ephemeron tables in Lua), a special reference type that is more semantically powerful than, e.g., weak references, and provides the necessary hints to the tracing collector. But it's still something you must explicitly declare. And the Big-O complexity of ephemerons is pretty bad, so it can degrade performance significantly if there are lots of cycles passing through the ephemeron.

    1. Re:Not JVM by Phydeaux314 · · Score: 4, Interesting

      I do some application development in Swift on iOS. It's... well, it has some issues, many of which stem from the issues you've pointed out.

      First, not every interface or function you need is available in Swift, so you end up spending a lot of time converting back and forth between the two languages in your code. This massively increases complexity and is generally a Giant Pain In The Butt. I really wish they'd finished making their system calls on iOS available in Swift (rather than having to bounce back to objective-C all the damn time) before they pushed it out to the public.

      Second, swift (and specifically how they use it on iOS) is an irritating blend of "we want things to be user friendly" (read: idiot proof) and "we don't want to hide too much out of the way." As a result, people coming from lower-level languages (like C or C++) will spend time fighting a some of the assumptions the system makes, and people coming from higher-level languages (like Java or Python) oftentimes will fall through the gaps.

      Take memory management, for example - it has garbage collection, so you don't need to worry about malloc and free, but it doesn't have extensive garbage collection, so as soon as you start using multiple references - sorry, pointers - in multiple places you start needing to worry about keeping track of how you're referring to things (strong vs. weak) so you don't end up using more memory than you need to.

      So, no, I don't really like Swift. It's not bad, and I'd work with it if I had to, but it's sort of sitting awkwardly between something lower level and something higher level and fully abstracted, and figuring exactly what they did and did not include is a pain in the butt to work with and around sometimes.

      --
      Never underestimate the stupidity inherent in all human beings.
  3. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by pushing-robot · · Score: 5, Funny

    compile it to JavaScript for deployment

    I have officially lived too long.

    --
    How can I believe you when you tell me what I don't want to hear?
  4. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by Anonymous Coward · · Score: 5, Informative

    The browser developer tools actually support source "map" files that allow you to step through the source - it's already used in the case where you concatenate and minify multiple javascript files into one

  5. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by binarylarry · · Score: 4, Funny

    perhaps there's a better term for this process?

    Kludging
    Webbing
    Derping

    --
    Mod me down, my New Earth Global Warmingist friends!
  6. What happened to C? by GuB-42 · · Score: 5, Interesting

    On GNU/Linux, you can use whatever langage you want as long as it supports the C calling conventions, and most of them do. Same thing for oldschool Windows and pretty much every system running native code.
    Why should a platform be tied to a particular language?

    1. Re:What happened to C? by squiggleslash · · Score: 4, Interesting

      For what it's worth, you can program Android in C. It's not recommended.

      C is widely considered unsafe, a language that makes it far too easy to accidentally introduce security holes that end up with attackers being able to execute arbitrary code. Managed languages like Java aren't perfect, but they fix 90% of these errors, leaving developers able to focus on the types of error that are because something was badly designed, not because a buffer's size is too small for the data being read into it.

      Mobile operating systems have enough security problems as it is without making it easier for programmers to introduce more.

      Java, FWIW, has only two major problems: it's absurdly bureaucratic, and its master, Oracle, isn't really happy with anyone writing incompatible variants of it and is trying to prevent that from happening.

      Meanwhile, nothing else has taken off. C# is almost as bureaucratic as Java, and, well, then there's Swift, but I'm having difficulty believing Apple will be less possessive of it than Oracle is of Java.

      --
      You are not alone. This is not normal. None of this is normal.