What does it mean for a language to be open source?

387 views Asked by At

As most of you are probably aware, Apple announced in 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 exactly does "open source" mean here? Is it that their implementation of the language (compilers etc) is open source? If so, why is this significant when anybody can just look at the language spec and build their own Swift compiler?

(And conversely, if a language is proprietary, does it mean third parties aren't allowed to write their own compilers/interpreters for it?)

2

There are 2 answers

0
Connor Pearson On BEST ANSWER

According to the Swift Blog it means the code for the Swift compiler and standard library will be open sourced.

  • Swift source code will be released under an OSI-approved permissive license.
  • Contributions from the community will be accepted — and encouraged.
  • At launch we intend to contribute ports for OS X, iOS, and Linux.
  • Source code will include the Swift compiler and standard library.
0
rickster On

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

However, a compiler is not the same as the compiler. Apple's Swift documentation might not be comprehensive in describing every implication of every rule in the grammar, and even if it were, an independent implementation of those rules likely wouldn't behave identically. (You might be aware of a few Swift compiler bugs? Switching compilers might fix them... And give you a whole different set of bugs!)

Besides, many of the key promises of Swift aren't part of the language spec—things like great optimization for speedy generated code are part of the compiler implementation. And on top of that, a lot of the power of Swift comes from the standard library—for that, Apple's interface and documentation might be enough for one to create a similar implementation, but definitely isn't enough to tell you how to make one that's 100% compatible and with the same performance characteristics.

(I'm not a lawyer, but it's also worth thinking about whether there might or might not be legal questions to be resolved—Sun, Microsoft, and Oracle have been fighting over Java since before today's budding Swift programmers were born.)

And of course, all this assumes you find building out a modern compiler and library to be easy. I wouldn't call that trivial.


So, what does open source Swift mean? It means everyone gets access to the official compiler and library implementations. So it's possible for the community to do things like porting them to other platforms with the assurance of 100% compatibility. Or hack on it to make improvements that might find their way back into the official releases. Or use Swift as the starting point to develop something different (a purely functional-programming cousin to Swift, for example).