News for hackers. Stuff that matters.
Re:Silver: A free implementation of Swift for .NET, Java, An... by martingordon on Monday February 09, 2015 @12:05AM (#9019769)
I'm curious to know how well it performs. I spent the better part of this weekend rewriting 4k lines of Swift in Objective-C because I couldn't deal with the 60-90 second compile times.
Re:Silver: A free implementation of Swift for .NET, Java, An... by mythz on Monday February 09, 2015 @01:00AM (#9019889)
Swift has some land mine issues where the compiler can hit snags handling certain snippets of code (e.g casting to/from Any/AnyObject, method overloading based on constraints, etc) which if you have enough of them will segfault the compiler with something along the lines of "expression too complicated, break it down".

I've had to rewrite my approach a few times because of this to avoid certain coding techniques, but once I've rewritten to avoid them, Swift can happily compile my 7-8k LOC code-base in ~6s.

Re:Silver: A free implementation of Swift for .NET, Java, An... by martingordon on Monday February 09, 2015 @09:55AM (#9021403)
I don't think I'm doing anything too fancy, but who knows? I probably have too many conversions to Objective-C objects that I used to workaround beta compiler issues that are probably fixed by now, but I haven't found a lot of guidance on what to avoid (I'm declaring types pretty much everywhere) and since the compiler isn't crashing, the list of compiler crashes doesn't really help.

It's a shame because Swift is a neat language. But because Xcode doesn't support incremental compilation for Swift, a single character change causes the entire project to rebuild. Couple that with LLDB crashing because I'm including Objective-C frameworks (via Cocoapods), and the whole experience becomes absolutely terrible.

Re:Silver: A free implementation of Swift for .NET, Java, An... by epaga on Monday February 09, 2015 @02:30AM (#9020067)
Is there a list somewhere of Swift compiler issues to avoid? Seems like "avoiding certain coding techniques" is what is currently necessary until Apple gets back on top of things...

One other example FWIW: having a largish array of Int arrays causes the compiler to either go into an endless loop or simply take too long, UNLESS the type of the array is specified.

var data = [[1,2,3],[4,5,6], ... ] // > 20 elements -> compiler hangs

as opposed to:

var data:[[Int]] = [[1,2,3],[4,5,6], ... ] // compiles quickly

Re:Silver: A free implementation of Swift for .NET, Java, An... by mythz on Monday February 09, 2015 @02:49AM (#9020109)
Finding Swift really buggy atm - where XCode, Swift Compiler and SourceCode service routinely crashes multiple times a day for me. A lot of my time is spent sympathizing with the compiler and getting hit with hard fought lessons on what things to avoid - basically don't step too far outside the Swift Programming Guide. Apple's also glacially slow at responding to bug reports - I'm keenly waiting on the next Q/A release of XCode/Swift.

There's a whole repo dedicated to Swift compiler crashes being maintained at: https://github.com/practicalswift/swift-compiler-crashes

Re:Silver: A free implementation of Swift for .NET, Java, An... by 00098001918291 on Monday February 09, 2015 @03:25AM (#9020183)
If only this had been a language that was dogfooded to the rest of the company, we might not be dealing with these beta-like issues.
Re:Silver: A free implementation of Swift for .NET, Java, An... by interpol_p on Monday February 09, 2015 @05:18AM (#9020479)
I think it was - the first app written in Swift was Apple's WWDC app. Released before they announced Swift. Though it wasn't a hugely complex app.
Re:Silver: A free implementation of Swift for .NET, Java, An... by brudgers on Monday February 09, 2015 @07:58AM (#9020900)
Dogfooding usually implies that the technology is used in mainline business operations. It needs to be more than building a demo, it needs to provide sustenance.
Re:Silver: A free implementation of Swift for .NET, Java, An... by orta on Monday February 09, 2015 @08:40AM (#9021064)
This isn't strictly true, if you not the wording around this it is quite cautious, "written with swift". There are only 4 swift objects in the app.
Re:Silver: A free implementation of Swift for .NET, Java, An... by CmonDev on Monday February 09, 2015 @04:14AM (#9020291)
Are you saying you are OK with compiler performance affecting the design (and possibly quality) of your code??
Re:Silver: A free implementation of Swift for .NET, Java, An... by seabee on Monday February 09, 2015 @04:59AM (#9020423)
Nobody says you have to OK with something you mitigated against.

I remember on several occasions fighting Visual C++ over code it bombed out on. Having a precompiled header scheme to make up for poor performance. Yes it sucks, but you don't do these things because you think it's acceptable, it's because the alternative is more painful.

Re:Silver: A free implementation of Swift for .NET, Java, An... by preslavrachev on Monday February 09, 2015 @03:39AM (#9020212)
So, the Swift compiler is slow? I mean, I expected it to be slower than Objective-C due to its dynamic nature, but that slow?

Disclosure: I write Android apps, so I'm only occasionally peeking at how the iOS dev scene is developing. I've already been thinking of trying to write Android apps in Scala, but maybe this Swift to Java compiler is also worth looking at

Re:Silver: A free implementation of Swift for .NET, Java, An... by pjmlp on Monday February 09, 2015 @03:56AM (#9020255)
From what I known, Kotlin or Xtend are better options than Scala, regarding execution speed of the current code generation and package size, even with ProGuard.
Re:Silver: A free implementation of Swift for .NET, Java, An... by frowaway001 on Monday February 09, 2015 @06:46AM (#9020689)
No, not really.
Re:Silver: A free implementation of Swift for .NET, Java, An... by pjmlp on Monday February 09, 2015 @08:29AM (#9021016)
Any available benchmarks?
Re:Silver: A free implementation of Swift for .NET, Java, An... by frowaway001 on Wednesday February 11, 2015 @02:10PM (#9034901)
Considering this downvoting-because-I-don't-like-being-wrong ... maybe just benchmark it yourself.

If you have time for making stuff up and downvoting, then you surely have time to run some benchmarks.

Re:Silver: A free implementation of Swift for .NET, Java, An... by mikeash on Monday February 09, 2015 @02:12PM (#9023006)
Apple only just today released an update to the compiler that enabled incremental builds. Before that it had to recompile everything every time. That alone will probably make a big difference.
Re:Silver: A free implementation of Swift for .NET, Java, An... by martingordon on Monday February 09, 2015 @01:41PM (#9022817)
And of course, Apple just seeded an Xcode beta that supports incremental builds.