Live data from Hacker News

Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

elementscompiler.com

41–50 of 109 posts

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#41

Looks pretty shady. Proprietary code through-and-through, and it's "cross platform" because it compiles down to their own proprietary language. It's unclear how you deal with native libraries, if at all. I'll pass, thanks.

Proprietary code, completely unlike the Swift frontend.

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#42
post #27

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.

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…

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, Android, and Cocoa

#43
post #35

Earlier quoted context omitted.

.NET has NGEN since 1.0.

You can surprisingly effectively cross-compile C and C++ to Javascript now, with Emscripten.

The point is to AOT compile to native code.

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#44
post #42
post #27

Earlier quoted context omitted.

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…

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

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, Android, and Cocoa

#45
post #43

Earlier quoted context omitted.

You can surprisingly effectively cross-compile C and C++ to Javascript now, with Emscripten.

The point is to AOT compile to native code.

In fact that's exactly what it does: https://blog.mozilla.org/luke/2014/01/14/asm-js-aot-compilat...

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#46
post #13

Genuinely curious. Why Swift for multi-platform rather than C#, Clojure, JavaScript, or ?

Swift is statically typed, so it doesn't really compete with JS or Clojure. The company already has a C# implementation for sale. Also, Swift was designed to compile to native code, unlike any of the other three languages.

Mono supports ahead-of-time compiling to native code. I'm pretty that's used on iPhone.

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#47
post #12

Cool! But, is it possible that this violates Apple's TOS or any legal limitation on use of the Swift language? I remember there being a lot of heated discussion about making Swift officially open source back when it was announced, but I don't recall ever hearing anyone suggest a community project to make an OSS compiler for it. This is most interesting, but I'd love to know that Apple would be okay with this, or woul…

Programming languages cannot be copyrighted. It doesn't look like they've reimplemented any Apple APIs, so there wouldn't appear to be any room for an Oracle-style lawsuit claiming that standard library code was copied. I don't know what the trademark situation might be, though.

> Programming languages cannot be copyrighted

Are you sure? I'm genuinely curious to see a reference/precedent. Also, does that restrict patentability of programming language features? (I personally can see PLs not being copyrightable, but being patentable.)

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#48
post #12

Earlier quoted context omitted.

Programming languages cannot be copyrighted. It doesn't look like they've reimplemented any Apple APIs, so there wouldn't appear to be any room for an Oracle-style lawsuit claiming that standard library code was copied. I don't know what the trademark situation might be, though.

> Programming languages cannot be copyrighted Are you sure? I'm genuinely curious to see a reference/precedent. Also, does that restrict patentability of programming language features? (I personally can see PLs not being copyrightable, but being patentable.)

https://en.wikipedia.org/wiki/Oracle_America,_Inc._v._Google....

Re: Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa

#50
post #44
post #42

Earlier quoted context omitted.

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

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 relea…

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.
Post reply on HN