Google May Adopt Apple's Swift Programming Language For Android, Says Report (thenextweb.com) 172
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."
God damn it, just PICK A FUCKING LANGUAGE ALREADY! (Score:3, Funny)
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:5, 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.
Re: (Score:2)
I thought the trick for web browsers was to pick your own favorite fucking language, and compile it to JavaScript for deployment?
If you treat JavaScript as "machine language" to which the client side of a web application is transpiled, how does source-level debugging work?
Re: (Score:3, Insightful)
Poorly.
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (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
Re: (Score:2)
The OP needs to be upvoted. Source Maps is the correct answer.
Re: (Score:2)
It becomes web scale.
Re: (Score:2)
How "same" is it? (Score:2)
If you treat JavaScript as "machine language" to which the client side of a web application is transpiled, how does source-level debugging work?
The same way it does for any language compiled into a machine language.
So how do I attach, say, gdb to the JavaScript virtual machine of Firefox?
Or perhaps you did not mean "The same way" so literally. In that case, what would you describe as the same between debugging a program compiled to a machine language and debugging a program transpiled to JavaScript, and what would you describe as different?
Re: (Score:2)
So how do I attach, say, gdb to the JavaScript virtual machine of Firefox?
I doubt gdb supports such a thing.
In that case, what would you describe as the same between debugging a program compiled to a machine language and debugging a program transpiled to JavaScript, and what would you describe as different?
I assume the OP probably has a similar view but you need your source and your symbols so that you have that link between the source code and the compiled code.In the case of javascript it is called a "source map" and all the major browsers support them.
Re: (Score:2)
chrome or edge or firefox (pretty much any browser that supports source map debugging of javascript)
Thank you. That was the piece I was worried about.
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:5, Funny)
compile it to JavaScript for deployment
I have officially lived too long.
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:4, Informative)
compile it to JavaScript
That word. I don't think it means what you think it means.
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:4, 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.
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:5, Funny)
perhaps there's a better term for this process?
Kludging
Webbing
Derping
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:4, Funny)
Why do you hate YACC?
Re:God damn it, just PICK A FUCKING LANGUAGE ALREA (Score:4, Funny)
Hold on.
Before I can parse your expression, I must first derp the statement into javascript.
Web scale, bitches!
Re: (Score:3)
Cannot unread: http://zaa.ch/jison/docs/ [zaa.ch]
Re: (Score:2)
transpile
Re: (Score:3)
Re: (Score:2)
Good or not the idea is useful.
You want to write code to run in the browser but not in javascript.
Browsers support javascript.
Solution?
Is it a compiler? That is up for debate since I have seen programs that translate between pascal and c and they are called a translator.
I guess it comes down to how you define javascript is it a language or a vm? In the end it doesn't matter much since this is a tool that does something useful.
Re: (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...
Re: (Score:2)
His professor was the reincarnated Cantor.
Re: (Score:2)
Do you prefer transpile?
Re: (Score:3)
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 need
Re: (Score:3)
And if they can't do any of those, they become UX designers.
Re: (Score:2)
LOL That's lower than even *I* was went.
Re: (Score:1)
Next year's announcement: as we've realized that Swift wasn't invented by Google, we're deciding to replace it with a new own in-house language that will sit beside Go, Dart, Angular, and the rest of our toys that suckers think will be godsends, until we've got 'em hooked and change how everything works again.
Next-next year's announcement: we're dropping support for the Internet, as we've realized that it wasn't invented by Google. We're making our own version, as in-house studies have shown that we can sav
Re: (Score:2)
Re: (Score:2)
So essentially, You are saying that a browser will become a platform to distribute binaries? Because that's pretty much what You are suggesting.
Yes
(there will still be the HTML/CSS component which is not a binary)
Re: (Score:2)
Damn it Google, just pick a fucking language already ...
Really? In my experience, this is one activity that doesn't in itself require much in the way of language skills; others may have a different perspective, of course.
Opt for Swift, not Kotlin. Please! (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.
Re: (Score:3)
Isn't that true for any community (for their own definition of right).
Re: (Score:2)
Re: (Score:2)
Don't forget about React Native. Write native IOS and Android apps using JavaScript.
Re: (Score:2)
I've been getting back into both programming and coding lately. This is after a nearly 10 year hiatus or a 15 year coasting period. I really haven't done much since about 2001. Some small stuff online, that's it. I did some stuff with SMF for a while, was on their team actually, and I stopped that in 2007 or 2008.
The thing I've noticed is how much has changed. Oh wow... But, to be more specific and lend what I can, I've noticed that there's a JavaScript library for everything. There's also a Java library fo
Re: (Score:2)
The biggest coming wave is WebAssembly, which will let you write front-end code in C++. It's going to turn everything on its head, and my guess is we'll see completely new frameworks.
Re: Opt for Swift, not Kotlin. Please! (Score:4, 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.
Re: (Score:2)
I'm not what sure what you mean by "debug specs", but if it means you read through them to make sure they're clear, you seem to suck at your job.
I'm sure of what he means because I've done my fair share of debugging specs too. They have bugs just like software has bugs. Signaling between entities with lockup states. Arrows of causation pointing in different directions (A pushes data to B when data is available. C pulls from B when it needs data, A and C don't have a clue what each other are doing). Huge architectural mismatches with reality (802.11i started out treating 802.1X as a protocol layer (google "802.1X misuses" to my run in with that one)
Re: (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 abo
Re: (Score:2)
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.
I have dived into the rust ecosystem a bit, and can say that some crates are indeed how you describe it. Most of the crates I used however fulfil their tasks as they should.
That's why it took forever to get Rust 1.0 out
And now as Rust 1.0 is out, their promise of stability should be believed.
Re: (Score:2)
What about PHP???
Wash your mouth out!
Re: (Score:2)
Not only that but they removed the ++ and -- post and prefix operators.
It's a policy not to get stuck with syntax that is was acknowledged to be a mistake, and to update code from old to new with refactoring tools.
Despite their familiarity to C programmers, "for (;;)" and ++/-- are not good syntaxes.
"for item in collection" and "for i in 1...10" are far clearer. And any other loop shoe-horned into for (;;) is clearer as a while.
And ++/-- encourage side effect computing. Better to explicitly increment a valu
Google should then buy RemObjects... (Score:2)
and be done with it. RemObjecs Elements [slashdot.org] compiles Swift/C#/Oxygene(Delphi-lile language) to ios/windows/java/mac.
Not JVM (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.
Re:Not JVM (Score:5, 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.
Re: (Score:3)
Take memory management, for example - it has garbage collection, [...]
No, it has not.
Swift uses Automatic Reference Counting (ARC) [apple.com].
Stop developing now until you read and understood that document.
Re: (Score:3)
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) mob
Re: (Score:2)
Yeah. I like Swift, but the debugging isn't mature yet. XCode regularly crashes when you start putting breakpoints or single stepping though Swift.
Re: (Score:2)
Clearly he does understand it as he talked about needing to use weak references to break retain cycles.
What you don't seem to understand is that reference counting is a technique to do garbage collection. In Apple parlance they don't usually refer to ARC as a form of garbage collection, as they don't want to confuse it with the other and now abandoned auto garbage collection approach that they did just call the garbage collector.
Re: (Score:2, Insightful)
The JVM exists because Sun assumed Java would be running in very different devices without a proper OS and without ready access to a native compiler. None of these things hold true today. So the JVM is essentially just a layer of cruft slowing down your app. Android nowadays compiles the app into native code and modern JVMs compile at run time. So let's get rid of the JVM.
Re: (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.
Re: (Score:2)
Not necessarily, reference-counted memory management, plus weak pointers if you insist on creating circular references, free you from freeing, and don't have a memory penalty.
Re: (Score:2)
You are ignoring two other disadvantages: the power consumption of the first compilation pass is non-negligible, and the garbage collection mechanism creates quite a bit of overhead. So while in theory the JIT could be faster in practice it has never been. So if we are now JIT compiling (which precludes static analysis and optimizations) what is the use of the JVM?
Re: (Score:3, Informative)
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
Re: (Score:2)
Yes, there are trade-offs in both directions. Apple made the choice for ref-counting so that you have a consistent UI experience and generally lower memory overhead. For phone based apps I think this is the right choice. By the way, I don't think you can say that a GC is faster, just that it can be faster, in the real-world it can also be slower depending on how it's being used.
Personally I find GC to be a pain the rear due to the fact that it's generally a lot harder to resolve GC performance issues that
Re: (Score:2)
Apple made the ref-counting choice decades ago and now has to keep supporting it to maintain compatibility with their APIs.
Re: (Score:2)
There's also the fact that garbage collectors tend to require much more memory in order to maintain performance than reference-counting schemes. This is a huge part of the reason why Android requires so much more RAM than iOS.
This also means that performance just tanks on devices that rely on GC as memory gets close to full, which can lead to really nasty experiences.
I really think that making use of a garbage-collected language as the primary language in embedded devices is a bad, bad idea all-around. I
Re: (Score:2)
Given Oracle suing Google for IPR issues on their Dalvik rip-off of Java, it seems quite likely. Swift is open source and so doesn't carry that problem.
They could use another language other than Swift and Java. But Swift is fit for purpose, having been designed specifically with smartphones in mind. And although young, already has a lot of mobile developers who know it.
Re: (Score:2)
As a user, having seen the kind of code that's actually offered for me to use, I don't want it to be any easier than it absolutely has to be to leak memory. It can be really easy to drop a cyclic reference, or conversely really hard to keep track of when you have them. The programmers writing phone apps have shown that they're not up to that kind of challenge.
In this day and age, programmers shouldn't have to think about the internals of the runtime. Stuff should just work. And I'm willing to take a perform
Re: (Score:2)
Re: (Score:2)
Object o = new [cycle_detect] Object();
Or maybe make cycle_detect the default, so if you want cycle-free objects and know what you are doing, you can declare:
Object o = new [dangerous] Object();
Re: (Score:2)
Re: (Score:2)
I think it's very possible (even reasonable) to have a language which provides the option between different sorts of memory management. My point was mainly that it's really difficult to modify Java to use reference-counted memory management instead of the current garbage collection scheme. It's also going to be very difficult to move Android off of Java.
Currently Android developers can help the memory management situation by using the NDK and using C or C++, but I don't think that's very common. These la
Google - A disconnected beast? (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.
Re: (Score:1)
Go has no classes, swift has, It would be painful migrating a large api surface that currently heavily relies on classes to a language that has minimal support for OOP.
Re: Google - A disconnected beast? (Score:2)
Yep agree, but if you are porting a big oop based api set, you want to minimise the adjustments the devs need to make to use it.
What happened to C? (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?
Re: (Score:3)
Because corps wants to have locked in mindset developers tied to their solution.
Comment removed (Score:5, Interesting)
Re:What happened to C? (Score:4, 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/... [wikipedia.org] ), no lockdown here. For me, this is how managed should be done. And now that Microsoft opens up a bit, that's even better.
app privilege on Jellybean (Score:2)
I do not agree with this statement. The Towelroot kernel vulnerability impacts some KitKat and all versions below - any app that is able to download a small binary and run it from a shell can obtain root privilege.
KitKat and below are over 50% of the Android ecosystem at the moment, and app privileges are dangerously weak there.
Re: (Score:2)
C only has the fastest code because it has no safety. Use modern container classes that are safe, and it's no faster than other fast languages. In virtually every case the lack of safety for speed trade off of C is no longer necessary.
C still exists for the same reason COBOL exists, but it simply isn't as far down the road yet.
Re: (Score:2)
Unsigned int would be awfully nice ...
https://en.wikipedia.org/wiki/... [wikipedia.org]
Re: (Score:3)
Re: (Score:3)
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... [github.com]
Re: (Score:2)
I prefer a firm grip over a language over adding features without much afterthought, and then having to support those for all of eternity.
Re: (Score:2)
Yes, for what its worth, I think Apple has the balance about right.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Android does let you write your apps (or at least, the bulk of them) in C or any other language your want. But it's not the recommended approach. A lot of its libraries are written in Java, so you have to jump through a few extra hoops to use them if your code is running outside the VM. And you have to worry about providing binaries for different architectures, whereas with Java it takes care of that for you.
So you presumably could already use Swift when coding for Android. But that's not what this is a
What this really means... (Score:2)
1. Google adopts Swift programming language! ...
2. iOS developers port their iPhone apps to Android!
3.
4. Profits!
Re: (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.
Re: (Score:2)
Yeah, that'd be like Google basing their Browser on Apple's open sourced WebKit... and then forking it... Oh...
Why not just use c#? (Score:3)
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?
Re: (Score:2)
It does. Xamarin is pretty cool.
Have they learned nothing? (Score:3)
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?
Re: (Score:2)
Response to Xamarin (Score:2)
Why don't they use GO? (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.
Re:Apple fucked up (Score:4, Informative)
Re: Apple fucked up (Score:2)
I love the idea. I've got swift running in a raspberry pi and will be using it develop a game; while I've also done iOS development and want to keep my skills there too.
I love it. Bring me a well designed, performant language any day.
Re: (Score:2)
There's always Eclipse, if you really want an open source IDE for Android. Ugh.
Re: (Score:2)
The IDE for Android used to be Eclipse, but Google ended that [android.com].
Re: (Score:2)
How is the open talk false because something isn't open?
Re: (Score:3)
Isn't this it? [android.com]
Re: (Score:2)
Lol, funny. Swift with its millions of operators actually removes one.
Re: (Score:2)
It's removing four actually. x++, x--, ++x, --x
Re: (Score:2)
I followed the debate about removing them on Swift-Evolution [github.com] and at the time I was meh. However, I'm finding that I miss them. Maybe it's just muscle memory, however, I wish I had objected at the time.
There are a lot of breaking changes being proposed for Swift 3. While I don't think breaking changes should be banned because such a rule can stifle language development (see Java for example), I don't think the core team sets the bar high enough and I think they will get a bit of a shock at the backlash follo
Re: (Score:2)
I work on a code base of multiple mature apps, originally written in Obj-C, but gradually being transitioned to Swift.
It took a couple of hours to fix everything up. Most of it is automatic fix-ups. I'm glad for the change as it'll stop one of my co-workers writing stuff with this archaic syntax. The alternatives to "for (;;)" in particular are all superior.