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."

39 of 172 comments (clear)

  1. God damn it, just PICK A FUCKING LANGUAGE ALREADY! by Greyfox · · Score: 2, Funny

    Damn it Google, just pick a fucking language already and make it an option as an alternate to Javascript on the browser. Anything strongly typed and notably lacking in magic goddamn bullshit (Looking at YOU, Ruby) would be better than what we have now.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  2. 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.
  3. Opt for Swift, not Kotlin. Please! by Anonymous Coward · · Score: 3, Interesting

    I would much prefer to see them go with Swift.

    I've dabbled with both Swift and Kotlin, and the Swift community is a much nicer one to deal with. The Swift community is a lot like the Python and C# communities. They're friendly, not too opinionated, and when they are opinionated it's because they're right. If you have a problem, they'll help you out and everyone's happy. They aren't there to tell you what to do or how to do it. They just try to help you do what you want to do.

    I've found the Kotlin community to be more like the Rust, Ruby and Nim communities. There is a lot of cockiness, and they're way too opinionated, especially when their opinions are factually wrong so often. If you don't do things their preferred way, even if their way is the worst way possible, well you can just fuck off and die as far as they're concerned.

    Maybe the difference has to do with the age of the participants. Those working with Swift, Python and C# tend to be older, more mature and generally laid-back. Those working with upstart languages like Kotlin, Rust, Ruby and Nim tend to be young, angry, passive-aggressive, and perhaps impotent.

    If I were developing for Android, I'd much rather deal with the Swift/C#/Python type of community than the Kotlin/Rust/Ruby/Nim type of community.

    1. Re: Opt for Swift, not Kotlin. Please! by tepples · · Score: 3, Informative

      What do you need a community for? Read the language spec, read the api spec, done.

      For helping to clarify things that you failed to understand in said specs, and to help explain practical ramifications of said specs.

    2. Re: Opt for Swift, not Kotlin. Please! by Anonymous Coward · · Score: 3, Insightful

      Uhhhh, are you serious?

      The community will develop the libraries you use. You'll want to use libraries developed by a community that cares about doing things right, providing proper releases of these libraries, and maintaining them over the long term. Swift, Python and C# are good communities for this. Rust, Ruby and JavaScript are not. The Rust, JavaScript and Ruby communities just shit out partially-done libraries over a weekend, throw them on GitHub without any sort of formal releases, and then forget about them.

      The community will also help discover and document the best practices for using the language. This collective knowledge will do far more to help make the language efficient and effective for everybody to use. Anyone who is a lone wolf will waste a lot of time rediscovering what the community found out much earlier.

      The community also influences the direction the language will take. We see the Python, C# and Swift communities continually improving their languages. On the other hand, we see communities like Rust and JavaScript constantly spinning their wheels, since their "best practices" change every other day. That's why it took forever to get Rust 1.0 out, and it's also why JavaScript is only now getting proper class-based OO, 20 years after it was created!

      Programming language communities are very important. The last thing any programming language user needs is to deal with a community like the Rust community, where they often treat you like dirt.

    3. Re:Opt for Swift, not Kotlin. Please! by jrumney · · Score: 2

      when they are opinionated it's because they're right.

      Isn't that true for any community (for their own definition of right).

  4. 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.
    2. Re:Not JVM by lokedhs · · Score: 2, Informative
      I wouldn't be so quick to assume that reference counting requires less CPU cycles unless you have actual data to back up that claim.

      With reference counting every single allocation, as well as every single object ownership transfer requires extra CPU cycles and memory accesses to manage the memory as well as manage the counter (yes, I know Swift does some clever tricks to avoid the counting which frankly is the only reason it's as performant as it is). Also remember multithreading issues when updating the refcounter.

      With garbage collection, you obviously don't need to do any reference counter management, saving a lot of CPU and memory access cycles right there. But what is less obvious is that memory allocation itself is much faster with (compacting) garbage collector. After collection, all free memory will be in a single contiguous block, reducing the memory allocation operation to a single ADD instruction.

      So, in summary:

      With refcounting you have:

      • Slow memory allocations (need to manage a fragmented heap)
      • Slow accesses and pointer handovers (updates to the refcounter)
      • Slow free (need to manage the free list)
      • No asynchronous pauses (since there is no garbage collector)

      With a GC, you get:

      • Fast allocations (usually just an "add" instruction since the heap is not fragmented)
      • Zero cost accesses and pointer handovers
      • Zero cost free (just stop using the pointer)
      • Some asynchronous pauses and CPU usage while running the GC

      There have been plenty of research on memory management, and we're well past the time when you could say "GC is slower than the alternative".

    3. Re:Not JVM by Kartu · · Score: 2

      JVM has no problem being performant (thanks to advanced JIT, which, at least in theory, can even be faster than static compiler, as it has runtime information such as which branch is more likely to be taken).
      The only inherent disadvantage of it is memory footprint.
      But that's the price you pay for not having to malloc/free.

    4. Re:Not JVM by Andreas+Mayer · · Score: 2

      Take memory management, for example - it has garbage collection, [...]

      No, it has not.

      Swift uses Automatic Reference Counting (ARC).

      Stop developing now until you read and understood that document.

    5. Re:Not JVM by Elledan · · Score: 2

      My approach to mobile development (Android & iOS) is to write all of the logic and everything else I can in C++ ('Objective-C++'), then use some glue logic in Java/Objective-C/Swift where needed and native APIs aren't available.

      Writing an entire app in Java, Objective-C or Swift seems illogical, even if the app isn't intended to be cross-platform. Just being able to debug the core logic with mature C/C++ tools on a Linux/BSD PC is a godsend, and reusing the same code across two (or three, or four) mobile platforms is just awesome.

      --
      Site & blog: http://www.mayaposch.com
  5. 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?
  6. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by Anonymous Coward · · Score: 3, Insightful

    Poorly.

  7. 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

  8. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by TheReaperD · · Score: 3, Informative

    compile it to JavaScript

    That word. I don't think it means what you think it means.

    --
    "Be particularly skeptical when presented with evidence confirming what you already believe." -
  9. Google - A disconnected beast? by NaCh0 · · Score: 2

    Google has put a ton of effort into Go, why not add that as a first class language as well?

    I suppose Go/Java syntax are "close enough" at a high level. But kotlin? There are only so many ways to shuffle C & Pascal syntax before everyone is dazed and loses interest.

  10. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by HiThere · · Score: 3, Informative

    I think it actually does. At one point CDC was contemplating a machine that was going to use APL as the assembler language, to which other languages would need to compile if they were to run as native. So JavaScript can define a virtual machine that can be compiled to.

    Now whether that's a good idea is a different question.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  11. 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!
  12. 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 Lisias · · Score: 2

      Because corps wants to have locked in mindset developers tied to their solution.

      --
      Lisias@Earth.SolarSystem.OrionArm.MilkyWay.Local.Virgo.Universe.org
    2. 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.
    3. Re:What happened to C? by GuB-42 · · Score: 3, Interesting

      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.

      Right, but the core of Android (where security matters the most) is actually C or C++. In unprivileged mode, where apps run, security is important but not as much, because that arbitrary code will have no more permissions that the exploited app. Also, nothing prevents you from using a safe language that have C bindings.
      But there are advantages to managed languages, which bring me to...

      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.

      C# is just the tip of the iceberg, the CLI backend is the interesting part here. There are plenty of languages that target the CLI platform (see: https://en.wikipedia.org/wiki/... ), no lockdown here. For me, this is how managed should be done. And now that Microsoft opens up a bit, that's even better.

    4. Re:What happened to C? by fuzzyf · · Score: 2

      I think C# is getting really interesting. Watching the language specs being discussed and implemented on github is very nice.

    5. Re:What happened to C? by jeremyp · · Score: 2

      I'm having difficulty believing Apple will be less possessive of it than Oracle is of Java.

      Swift is already open source and while the core developer team (Apple employees) retains a firm grip on the language's direction, they have a process whereby anybody can propose new features for the language.

      https://github.com/apple/swift...

      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
  13. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by radarskiy · · Score: 3, Funny

    Why do you hate YACC?

  14. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by Anonymous Coward · · Score: 2, Funny

    You're an idiot. A compiler takes code written in one language and translates it in to code written in another language. That the source and target languages are typically a high-level language and a machine language is irrelevant.

    Find yourself a copy of the dragon book. It's right there at the beginning.

    Kids these days...

  15. Re:Apple fucked up by D.McG. · · Score: 3, Informative

    Apple open sourced the language. They did NOT open source UIKit, CoreAnimation, etc. Many iOS devs are Android devs as well. While this will allow for a common language between the UI and the shared C++ code, the UI code will still be platform specific.

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

    Hold on.

    Before I can parse your expression, I must first derp the statement into javascript.

    Web scale, bitches!

    --
    Mod me down, my New Earth Global Warmingist friends!
  17. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by DraconPern · · Score: 2

    You are describing asm.js. It's scary, and amazing at the same time.

  18. Re:Might want to open source by non0score · · Score: 2
  19. Why not just use c#? by Barlo_Mung_42 · · Score: 2

    It's already open source and it already runs well on Android. What do they think they'll gain by doing a bunch of work to use Swift?

  20. Re:What this really means... by Kartu · · Score: 2

    I frankly think this is most likely just an attempt to bring attention to Swift.
    It's hard to imagine Google switching to it, to say the least.

  21. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by KGIII · · Score: 2

    I'd argue that they also need to learn the history of computing and networking as well as the physical components (how they actually work - physically) and the basics of safe hex. I'd say that those are just as essential as any use is at this point in time. A good grounding in real computer science should actually cover the science of computing, no? They should actually know that what they're using is a tool and, like all tools, it should be operated both with skill and safety. In order to do that, one needs to truly understand the reasons that things are the way they are.

    Beyond that, or along side that, they could learn the software aspects that you're suggesting. However, learning to program is not learning computer science. Learning to program does have value but that would be greatly improved by actually having a healthy dose of computer science so that they can tie it all together. If we just want cheap code monkeys, we can go buy those. If we want people who are actually skilled, we have to teach that.

    I think that one, without the other, is not nearly as valuable as both of them combined. Someone who understands what ring 0 is actually might understand why code that doesn't race is imperative. Someone who understands the history, will know what mistakes have been made and learn from them. Someone who has an understanding of the networking, how it physically works, might actually be able to code with security in mind. Someone who knows the actual physical aspects of memory will understand that buffer overruns are bad - and why. Then, they will know who, what, when, where and how they worked to avoid them. They'll understand what sanity checking actually means and why it's essential.

    And those that can't? Well, someone's gotta work help desk, manage, and be QA.

    --
    "So long and thanks for all the fish."
  22. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by Hognoxious · · Score: 2

    And those that can't? Well, someone's gotta work help desk, manage, and be QA.

    And if they can't do any of those, they become UX designers.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  23. Have they learned nothing? by sad_ · · Score: 2

    Google has, how many languages that they developed themself available they can use?
    But still they would pick a language, not developed themselves, but by a competitor.
    And they would do this why? Because they didn't learn from the whole Java debacle?

    --
    On a long enough timeline, the survival rate for everyone drops to zero.
  24. Response to Xamarin by MadcapMac · · Score: 2

    This has all the smell of a response to Microsoft's purchase of Xamarin. By extending their reach, Google is attempting to diminish the effect C# may have on their ecosystem.

  25. Why don't they use GO? by thatjavaguy · · Score: 2

    I know that Go is being pitched as a systems language - but surely it would be easier for Google to do the work necessary to switch to Go and improve it than use Swift.

    Based on my (brief) look at Swift it seems to me that they have tried to be too clever by half - throwing everything in to it. Love or hate Java, C, Go - they have the benefits of being clean and simple languages.

  26. Re:God damn it, just PICK A FUCKING LANGUAGE ALREA by radarskiy · · Score: 2

    Cannot unread: http://zaa.ch/jison/docs/