Silver: A free implementation of Swift for .NET, Java, Android, and Cocoa
elementscompiler.com
elementscompiler.com
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.
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.
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
There's a whole repo dedicated to Swift compiler crashes being maintained at: https://github.com/practicalswift/swift-compiler-crashes
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.
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
If you have time for making stuff up and downvoting, then you surely have time to run some benchmarks.
They do however state it is free for use.
"Patterns are not supported in Switch cases, yet"
:(
I'll pass, thanks.
They are supporting their implementation of Pascal for several years now, and my experience of using DataAbstract from obj-c show the interfacing is good.
I believe most of us who actually use Objective-C choose it not because the language itself is designed to be simple and elegant, (and yes the language is simple and elegant,) but because the Cocoa and Cocoa-Touch are well supported by Apple. No offence to the effort outside of APPL, but it is not enough to support a full-fledged eco-system with all 3rd-party F/OSS written in Objective-C that is compatible with what Apple currently uses in order to build reusable components. GNUStep has existed for so many years, and Étoilé for years as well, but I did not see emergence of adoption in community comparable to that of other popular F/OSS frameworks, e.g. Mono and Qt. And I do not see how this issue could be circumvented, unless some big player shows up and adopt any of these projects, like what Google did to Android.
I don't know what the trademark situation might be, though.
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.)
There's not really any case law I'm aware of in the US, mostly because nobody's ever tried. Copyright doesn't cover "facts, ideas, systems, or methods of operation". You can trademark the name of a language, and its documentation and any distributed software are under copyright, but the process required to translate that language into machine code isn't eligible for copyright.
Parts of the implementation might be patentable, but I don't know of any cases of anyone successfully patenting a programming language.
The Oracle vs. Google lawsuit is still going back and forth in the courts. It's worth noting that even Oracle isn't claiming that the parts of Android that involve parsing and compiling Java code are infringing on their copyright. The matter of controversy is that they claim copyright on the design of the Java standard library.
Swift's standard library is pretty much Cocoa, which isn't being rewritten here.
> RemObjects Silver is absolutely free of charge to use, both during the current beta period, and once we release the shipping version.
so it isn't free software at all.
Why Swift for multi-platform rather than C#, Clojure, JavaScript, or <insert other language here>?
Also, Swift was designed to compile to native code, unlike any of the other three languages.
This seems to imply that developers make a static vs. dynamic choice separately prior to and separate from evaluating other aspects of languages to choose between them. While some developers may do that all the time, and some may do that some of the time, I don't think its true as a generalization.
Certainly Go is statically-typed, and often portrayed as competing fairly directly with Ruby/Python, which are not.
I guess I should clarify that I get why using Swift for OSX and iOS might make sense. The question is about using it for other platforms.
Swift was designed for the iOS platform as a replacement for Apple's dialect of Objective C. This is an unmanaged environment. There's no VM or garbage collection, although both languages support automatic reference counting.
C# was designed for the CLR and has a large standard library that relies on garbage collection. It also has features permitting calls into unmanaged code, but the language was still designed for a VM.
The presence of garbage collection has nothing to do with being native or not.
Besides a language runtime and VM aren't the same thing.
Actually Swift makes use of Objective-C runtime to achieve interoperability with Objective-C libraries.
Oberon, Oberon-2, Modula-3, Component Pascal, D, Spec#, Dafny are all examples of languages that compile to native code, were used to write operating systems and use garbage collection.
In the context of that blog post, there are two compilation steps: First emscripten would be used to produce JS. Then Mozilla's JS engine would compile that JS down to machine code at runtime.
They call the latter step with OdinMonkey AOT when they compile the entire thing at runtime, but before starting execution. But the way most people differentiate, this would still be considered JIT - it still depends on executing the compiler each time the application is started.
Ahead of time compilation is used to describe the process of generating machine code at compilation time, in a form that can be executed directly by a processor without any additional transformation process.
Which clearly is not happening here, as the code is converted into JavaScript and relies on a JavaScript implementation to run. Regardless of the optimization processes used by the JavaScript engine.
http://compilerjobs.com/db/jobs_view.php?editid1=984
If parser API succeeds, we will also target making a compiler.
It's ABI compatible with Cocoa, all classes end up usable from Cocoa.
It does not use the swift runtime.
The type systems is even better and more advanced. Coming from Swift I was kinda surprised that its pattern matching was a statement and not an expression, as typical functional languages do.
Overall, while OCaml is a truly beautiful language (and I do really enjoy writing in it[1]), it is really tough to get work done efficiently because so few resources seem to exist.
With that said, I discovered a mod_ocaml Apache module implementation[2] (that is really outdated and not very efficient) and moved it to github. (I am not the author, nor have I had time to work on it either.) But if there was any interest in reviving this, I'd certainly give it a go. This seems to be a potentially viable way to increase interest in server-side OCaml usage.
[0] http://caml.inria.fr/resources/doc/index.en.html
That might have been true 5 years ago, but the OCaml Community site [0] is rather easy to find and links to many tutorials and books. Among these is the excellent Real World OCaml [1] book which is pretty great for experienced developers switching languages and available in print and freely online. Other resources for more beginning programmers exist as well. The INRIA resources are, indeed, rather poor and except fro the language reference, rather outdated.
Directly programming for Apache hasn't been popular for years now in any language I know (actually, only mod_php is popular, if at all, mod_python is completely dead and no idea about mod_perl). Usually languages have their own servers that get reverse-proxied by a frontend server like Apache or Nginx. And for this purpose Ocsigen [2] has been available (allowing an front-and-backend OCaml approach). If something simpler is desired, CoHTTP [3] exists, which is both a HTTP client and server. Reviving mod_ocaml is, in my opinion a waste of time and effort.
My comments on mod_ocaml were also a little vague. When I began server-side programming I loved mod_php because of how simple it was. I only brought up mod_ocaml because (if it worked) it is probably the single easiest way to start writing ocaml web pages. Given, it is absolutely not performant whatsoever. I just kinda saw it as a gateway from hobbyist-level interest.
Thanks for all your resources though!
I would have just pinged privately but I don't see any contact link on the page.
This particular one appears to not be open source, though.
I guess so, ditto with .net and android -- that's what happens when a programming language creator, here Apple, specs out a language at the same time they implement it. Could be why Swift is getting many implementations whereas a language only paying lip service to the idea of a spec, say Groovy after Dec 1995, is still stuck on one impl.
Otherwise I have to go with HaXe
Deleted comment
It would also make for a push in the market for this style of x-plat dev. If you can get to the major and minor platforms with one code-base and a single-stack dev team, oh what a smooth world it could be.
Windows 10 on all devices, written in Swift to a universal in visual studio. Wonder if I'd get to see a macbook running windows with a dev writing swift in VS.
Is the longview really that a closed platform with a narrowly used language will increase the share of revenue from Mac sales?
Swift + walled garden are OK for selling phones, but for OSX to go beyond <10% of PC marketshare, they could use a language to erode resistance to Macs in the biggest markets for PCs. Microsoft puts Office on the Mac. Now, you can also have business systems built on Swift that can work on shiny Mac hardware AND crusty Windows boxes.
You buy this company because they love Swift and can help get a foothold on dev teams in the enterprise. No matter how many kids come up using Swift to make their phone apps, they are going to get pushed into building C# and java, and a bunch of other languages, using other hardware and tools, when they joins the ranks. You buy this company so you can control the direction of their efforts and use it to put more eggs in other baskets.