How cross-platform is Swift ? Are the GUI libraries platform-dependent or independent ? I.E: can i write a single Swift program with a GUI that will compile, work the same and look similar on multiple platforms: Linux, Mac OS, Real Unix-es & BSDs, AIX, Windows ?
GNUstep has an implementation of the core GUI frameworks (AppKit and a few others), but the open source version of Swift doesn't have Objective-C interop, which is really the only compelling feature for Swift: it's a good incremental language if you have a lot of legacy Objective-C code.
by Anonymous Coward writes:
on Wednesday January 11, 2017 @10:01AM (#53647425)
You obviously know what you are talking about but I'd have thought it'd be trivial to interface the open source version of Swift with GNUstep. Well, at least they stopped desecrating Objective-C with Java syntax. IMHO, although it's sad they completely removed the dynamic aspect of ObjC, swift is the best of all the toy languages. I was comfortable using it to write a full program right away and I do mostly embedded C. The only downside is that it is a bit of an NP-hard problem to decide whether a correct program will compile after adding a line break.
I'd have thought it'd be trivial to interface the open source version of Swift with GNUstep
Unlike Clang, the Swift compiler doesn't have very clean interfaces for abstracting the different Objective-C implementations (clang does because I wrote them, before Apple added support for their runtime). Instead, when you build Swift, you have a bunch of #ifdef __APPLE__ things that turn off the Objective-C interop for non-Apple platforms. This also means some quite big ABI changes, for example the Swift CoreFoundation implementation has different object layouts to the ones that Apple uses and the way
"Just think of a computer as hardware you can program."
-- Nigel de la Tierre
Cross-platform (Score:5)
How cross-platform is Swift ?
Are the GUI libraries platform-dependent or independent ?
I.E: can i write a single Swift program with a GUI that will compile, work the same and look similar on multiple platforms: Linux, Mac OS, Real Unix-es & BSDs, AIX, Windows ?
Re: (Score:1)
None of Apple's GUI libraries are open source or cross platform and they never will be.
Re: (Score:3)
Re: Cross-platform (Score:0)
You obviously know what you are talking about but I'd have thought it'd be trivial to interface the open source version of Swift with GNUstep.
Well, at least they stopped desecrating Objective-C with Java syntax.
IMHO, although it's sad they completely removed the dynamic aspect of ObjC, swift is the best of all the toy languages. I was comfortable using it to write a full program right away and I do mostly embedded C. The only downside is that it is a bit of an NP-hard problem to decide whether a correct program will compile after adding a line break.
Re: (Score:3)
I'd have thought it'd be trivial to interface the open source version of Swift with GNUstep
Unlike Clang, the Swift compiler doesn't have very clean interfaces for abstracting the different Objective-C implementations (clang does because I wrote them, before Apple added support for their runtime). Instead, when you build Swift, you have a bunch of #ifdef __APPLE__ things that turn off the Objective-C interop for non-Apple platforms. This also means some quite big ABI changes, for example the Swift CoreFoundation implementation has different object layouts to the ones that Apple uses and the way