3 ms·
C#'s implementation was closed source and tied to a totally novel (at the time) API suite in .NET. Swift has the advantage that it's tied to already known APIs,
by Jtsummers 12y ago
C#'s implementation was closed source and tied to a totally novel (at the time) API suite in .NET. Swift has the advantage that it's tied to already known APIs, and that it can call into C/ObjC code, and they can call into Swift. At this stage it's probably too early to say whether Apple will or will not open source their Swift implementation. Again, pointing to a successful proprietary language, C# didn't have an open implementation until Mono came along in 2004. And that project had to develop a lot more infrastructure. We just (I hate that word, but in this case it's not totally wrong) need a compiler front-end for Swift. Under the hood it's using the same LLVM workflow that clang uses. So keeping the language closed-source won't last for long anyways.
EDIT: C# could call into C++ from the start, and I believe the reverse was also true. So platform-wise, MS matches the Swift<->ObjC/C bridge as well. I forgot about that detail.
- drdaeman 12y agoIndeed, source code availability of the compiler implementation and accompanying infrastructure doesn't really matter. It takes time but it could be re-implemented from specs. The problem with C# and .NET is (was) that they are patent-encumbered and that's the real game stopper. It took quite a long time and a lot of debate on .NET suitability for a Free Software movement to settle that matters somehow (recent releases under Apache license seem to fix many issues, though, although that still needs a statement from FSF's lawyers). I'm unaware about Swift relationship to software patents. Does anyone know?
- ygra 12y agoC# can call C, but not C++, except for COM interfaces (which have a defined external interface and mechanisms to get around the drawbacks of C++ libraries). To use normal C++ from C# you have to implement a bridge that's both C++ and managed code.
- Jtsummers 12y agoAh, ok. I've seen it in code bases but never had to touch those sections (and it's not used in anything I'm developing, pure C# code for my projects). Thanks for the info.
- narag 12y agoIf you're arguing that C# succeeded despite not being open source, consider that Microsoft's tools at the time were EOL'd, so transition was forced for MS tech users.