What does it mean that the language is open source?

As most of you know, Apple announced at WWDC 2015 that Swift will become an open source language.

My question is, since the language itself is essentially just a set of grammar rules, what does "open source" mean here? Is it that their language implementation (compilers, etc.) is open source? If so, why is it important when someone can just look at the language spec and create their own Swift compiler?

(Conversely, if a language is proprietary, does that mean that third parties are not allowed to write their own compilers / interpreters for it?)

+3


source to share


2 answers


According to Swift Blog, this means the code for the Swift compiler and standard library will be open source.



  • The Swift source code will be released under a permissive license approved by OSI.
  • Community contributions will be accepted and encouraged.
  • At launch, we intend to provide ports for OS X, iOS and Linux.
  • The source code will include the Swift compiler and standard library.
+7


source


Given the formal description of its grammar (and the meaning of each rule in the grammar), anyone can write a compiler a for the language. And indeed, people have redefined their own Swift compilers - browse the web and the App Store and you'll find some interactive Swift tutorials that don't use Apple's compiler.

However, compiler a is not the same as compiler... Apple's Swift documentation may be incomplete in describing every meaning of every rule in the grammar, and even if it were, independent implementations of those rules probably won't behave the same. (You may be aware of a few Swift compiler errors? Switching compilers can fix them ... and give you a whole bunch of errors!)

Also, many of the Swift promises keys are not part of the language specification - things like big optimizations for fast-generated code are part of the compiler's implementation. And on top of that, most of Swift comes from the standard library - it's enough Apple's interface and documentation to create a similar implementation, but definitely not enough to tell you how to make one that are 100% compatible and have the same performance. ...

(I'm not a lawyer, but it's worth considering whether or not there may be legal issues that need to be resolved.) Sun, Microsoft, and Oracle have fought over Java since early Swift programmers came along. )



And, of course, all of this assumes that you can easily build a modern compiler and library. I would not call it trivial.


So what does open source Swift mean? This means everyone gets access to the official compilers and libraries.... Therefore, the community can do things like port them to other platforms with a 100% compatibility guarantee. Or hack it to make improvements that might be reflected in official releases. Or use Swift as a starting point to develop something else (like a purely functional cousin programmer for Swift).

+4


source







All Articles