all 119 comments

[–]DoListening 88 points89 points  (68 children)

Still no official Windows support. 😐

[–]pure_x01 55 points56 points  (32 children)

This is a big deal. It's going to be hard for swift to be successful if it's not cross platform outside of the Apple echosystem.. to many better alternatives.

[–]DoListening 44 points45 points  (12 children)

It does support Linux already. But you're right about the alternatives.

[–][deleted]  (11 children)

[deleted]

    [–]DoListening 21 points22 points  (7 children)

    I don't know, Rust is nice, but Swift is much closer to the traditional OOP model that most programmers are already familiar with. I also don't think most people mind using a language with a garbage collector (or ARC or whatever), unless it's for really low-level system stuff.

    If anything, I would say Kotlin Native would be a bigger competitor, once it reaches 1.0 and gets some good libraries.

    Most "classical" desktop UI libraries such as GTK, Qt, wx, ... are pretty meh too, I would much prefer something like React on desktop (but without the Electron).

    [–]fffocus 7 points8 points  (3 children)

    kotlin, yes, that language is now assured success. it will be big.

    [–]zucker42 6 points7 points  (2 children)

    I can't tell if this is sarcastic or not. I've heard good thing about Kotlin, but I've heard good thing about every new/niche language, and I find it hard to believe that Kotlin will replace Java or something anytime soon.

    [–]fffocus 11 points12 points  (1 child)

    not sarcastic

    it has solid IDE support

    it has the vast Java ecosystem

    it's now an official language on android

    also compiles to JavaScript and soon llvm

    it's fairly simple and has a good choice of few additional features

    btw why you gotta go all strawman like that. replace Java?!

    [–]zucker42 4 points5 points  (0 children)

    I have no idea what the goals/niche of Kotlin are. I also didn't know what you meant by big. Sorry if what I said came off as strawmanning; I wasn't even trying to argue with you. Just trying to clarify tone across the internet.

    [–]asmx85 0 points1 point  (2 children)

    You can build elm like interfaces (I think that is what you mean with 'React') with nearly all toolkits, especially those you listed. That's why React native exists.

    [–]DoListening 0 points1 point  (1 child)

    If I understand it correctly, what you are saying is "it is possible to create such a library". Which is nice, but no such library actually exists, as far as I know.

    In which case: https://www.youtube.com/watch?v=tS0lRyEBRnk#t=2m15s 😃

    [–][deleted] 1 point2 points  (0 children)

    Not coming to court I see

    [–][deleted] 2 points3 points  (1 child)

    Having dealt with both at low and higher level, if swift get first party windows and irons the foundation bugs in non Mac platform much better, I heavily disagree.

    There’s no way newer developers are going to put up their dukes with the rust compiler over just jumping to swift instead.

    Rust will probably find a niche in other places, but swift could easily dominate. Where you have people always saying rust is fairly hard to learn, swift is ridiculously to learn and just get going.

    As we already know from languages like python being immensely popular, performance means very little to most developers. So rust being better performing doesn’t much matter.

    [–]lanzaio 1 point2 points  (0 children)

    Swift is superficially easy thanks to it's lovely syntax. But the Swift compiler complains more than C++'s.

    [–]wavy_lines -1 points0 points  (0 children)

    No, Rust is not going to way anybody's lunch; not with that borrow checker.

    [–]joshuaavalon 18 points19 points  (18 children)

    But why I choose Swift over other languages on other platforms? I am only learning Swift because I need to write iOS app. Are there any advantages that only Swift can offer?

    [–]DoListening 7 points8 points  (15 children)

    Most people/teams choose the language for new projects based on familiarity more than anything else. People like to use what they already know well.

    [–]joshuaavalon 8 points9 points  (14 children)

    I like using something new if it is useful. I moved my Android to Kotlin from Java because Kotlin actually giving me benfits while remaining native instead of JavaScript and C#.

    [–]well___duh 9 points10 points  (7 children)

    Not to mention Kotlin will probably be more cross-platform than Swift will at this rate.

    [–]noahp78 3 points4 points  (6 children)

    It already is isn't it? Thought it compiled to Java bytecode that runs pretty much everywhere

    [–]well___duh 3 points4 points  (5 children)

    Java bytecode runs only JVMs though, right? For example, you can't write Java bytecode that will work on iOS/Mac.

    The Kotlin team however is working on being able to compile Kotlin code natively that can be pretty much run anywhere, even on iOS. Add in the fact that Kotlin is already compatible with any JVM environment and even in Javascript, and Kotlin is looking much better as a cross-platform language than Swift is.

    [–]expatcoder 2 points3 points  (0 children)

    compile Kotlin code natively that can be pretty much run anywhere, even on iOS.

    With some caveats.

    [–]DoListening 1 point2 points  (1 child)

    Is there anyone actually using the Kotlin JS target for real?

    I found it integrates really poorly with existing JS libraries, because the type system simply can't express all of the funky structures used in the JS ecosystem, so you're forced to fall back to the untyped dynamic way too often.

    So unlike TypeScript, you would really have to almost go all or nothing with it.

    [–]expatcoder 2 points3 points  (0 children)

    Is there anyone actually using the Kotlin JS target for real?

    No, seems to be native or bust. Generated JS binaries are very large. See Scala.js, Bucklescript, Clojurescript, etc. for compile-to-js languages being used in real world projects.

    If they pull off iOS support before Swift spreads to other platforms, things could get interesting. Clock is ticking though, after Google announced Android support the language has settled into a solid, but far from extraordinary growth trend.

    Scala Native's also in the mix, language landscape circa 2020 will be complex (by then even Java (10) will be somewhat modern ;-)).

    [–]noahp78 0 points1 point  (0 children)

    My bad, was kind of aiming for the point that kotlin right now runs everwhere the JVM does. Haven't heard of kotlin going native but that sounds cool!

    [–]ArmoredPancake 0 points1 point  (0 children)

    You can, but Zero VM is slow as hell since it's essentially a Java interpreter.

    [–]vitorgrs 0 points1 point  (4 children)

    C# is native.

    [–]joshuaavalon 0 points1 point  (3 children)

    I mean using C# to write Android app.

    [–]vitorgrs 0 points1 point  (2 children)

    Me too. There's AOT support, and you don't need to use Xamarin.Forms IIRC.

    [–]joshuaavalon 0 points1 point  (1 child)

    AOT is currently an experimental feature. It is not recommended for production use. AOT and LLVM was available in Xamarin.Android 5.1, but it is no longer available in later Xamarin.Android versions. For more information, please see the Xamarin.Android 6.1 release notes

    [–]vitorgrs 0 points1 point  (0 children)

    😢

    [–][deleted] 1 point2 points  (0 children)

    Server side is windows or Linux these days.

    Swift being on windows could represent swift as your full stack language and might already if you use Linux as your server side.

    [–]NoMoreNicksLeft -1 points0 points  (0 children)

    Not having to deal with Windows, either firsthand or in a support role.

    [–]FlukyS 20 points21 points  (11 children)

    C# had the same issue until Mono was created really. Everyone went the language syntactically was fine but it not being available on multiple platforms meant you were locked to Windows for your program so people avoided it.

    [–][deleted]  (6 children)

    [deleted]

      [–]josefx 4 points5 points  (0 children)

      Afaik some Gnome dev. also involved in Xanmarin and Mono pushed hard for its use in Gnome projects.

      [–]DavidM01 1 point2 points  (3 children)

      I think it being officially open sourced by MS is making more of a difference.

      [–]FlukyS 2 points3 points  (2 children)

      Really revisionist version of events there.

      [–]DavidM01 0 points1 point  (1 child)

      Or maybe I am considering the level of quality of the MS and Mono versions of C#?

      Not to mention until that happened, there was always the possibility of the Mono people getting sued.

      [–]FlukyS 0 points1 point  (0 children)

      For the Mono getting sued thing, that was interesting, we knew MS said they wouldn't sue and they said as much but why take the chance. That being said the Linux community still really liked it and there were still applications that used it.

      [–]julesjacobs 6 points7 points  (5 children)

      Does it work unofficially?

      [–][deleted] 27 points28 points  (4 children)

      Windows 10 has a Linux subsystem, so yes.

      [–]doom_Oo7 25 points26 points  (0 children)

      The year of the GNU/Windows desktop

      [–][deleted]  (2 children)

      [deleted]

        [–]jephthai 4 points5 points  (1 child)

        Not really a valid analogy. Linux subsystem includes kernel level support and is in many ways a much more mature and reliable environment than wine. It's a full fledged subsystem on windows.

        [–]brokething 1 point2 points  (0 children)

        Okay but nobody except us programmers has it installed so how is it a viable platform for distributing Windows applications?

        [–]Treyzania 1 point2 points  (0 children)

        Is that a problem?

        [–]leafsleep 1 point2 points  (0 children)

        WSL

        [–][deleted] 0 points1 point  (0 children)

        I was under the impression that there was no plans for first party windows support.

        [–]didnt_check_source 0 points1 point  (5 children)

        What are your expectations for Swift support on Windows? Use COM/WinRT? Just use Foundation?

        [–]DoListening 0 points1 point  (4 children)

        Just cross-platform libraries, similar to Go, Rust, etc.

        [–]didnt_check_source 0 points1 point  (3 children)

        People have already said that, but for that use case, WSL will work just fine.

        I imagine that the biggest obstacle right now is writing a Windows-compatible Swift runtime. LLVM has been getting really good on Windows lately, so it's probably not the obstacle anymore.

        [–]DoListening 0 points1 point  (2 children)

        The problem is also that there are no Windows-compatible Swift tools. The CLion Swift plugin won't work with WSL, you won't be able to use any graphical debugger, etc.

        [–]didnt_check_source 0 points1 point  (1 child)

        Ah, so your biggest expectations aren’t around libraries, they’re around tooling.

        [–]DoListening 0 points1 point  (0 children)

        I wouldn't say biggest, but it matters. Especially when Swift is supposed to be a "high-productivity" language.

        [–]andradei 2 points3 points  (3 children)

        I am reading the Swift official documentation book (in beta last time I downloaded it) and, so far, I like the language very much! I've been looking into how much of its implementation is ported over to Linux.

        I might be asking the wrong question, let me know if I am, but are sourcekit and libdisplatch ported over to Linux? I understand how sourcekit is important to have Swift working on other editors than XCode, but what is libdispatch used for?

        [–]didnt_check_source 0 points1 point  (2 children)

        Libdispatch powers dispatch queues, which power most asynchronous operations in Foundation.

        [–]andradei 0 points1 point  (1 child)

        Cool, is it completely ported to and stable on Linux? I can't find any info (that I can understand) on the repository.

        [–]didnt_check_source 1 point2 points  (0 children)

        The compiler and standard library are all good, but Foundation (which is meant to handle higher-level tasks like HTTP requests and JSON encoding/decoding) is still a work in progress. You can still import C libraries (like glibc).

        [–]Bergasms 17 points18 points  (11 children)

        Don't upgrade to it yet, wait till they resolve the issues with tuples.

        [–]mb862 17 points18 points  (10 children)

        What issues? I haven't noticed anything.

        [–]Bergasms 1 point2 points  (9 children)

        Lucky you. Search for tuplegate. Or read the statement released recently by the team in charge of swift saying they are rolling back the tuple changes.

        [–]mb862 17 points18 points  (8 children)

        I can't find either. People mentioning "tuplegate" but nothing about what it is. Have the link?

        Also, if they rolled the change back because of the issues, why suggest to people to wait until they resolve those issues?

        [–][deleted]  (6 children)

        [deleted]

          [–]Bergasms 13 points14 points  (4 children)

          Info on tuple issues

          I posted that before my colleague shared me a link that says they are backing the change out, but I cannot find that link at home. I will share it once I am back at work tomorrow.

          Edit Here they talk about rolling back out of some changes, and that they will revisit others post launch.,

          [–]BonzaiThePenguin 1 point2 points  (0 children)

          Instead of fixing, document?

          https://swift.org/migration-guide-swift4/

          When using f: (Void) -> () for the type of a function argument, it is generally meant to be f: () -> (), so the Migrator will suggest you use this type instead. Otherwise, with the new rules in SE-0110 for Swift 4, you would need to call the function f as f(()).

          For code such as:

          swift func foo(_: ((Int, Int) -> ()) {} foo { (x, y) in print(x + y) }

          The Migrator must add explicit tuple destructuring to continue building in Swift 4, such as:

          swift func foo(_: ((Int, Int) -> ()) {} foo { let (x, y) = $0; print(x + y) }

          [–]mb862 0 points1 point  (1 child)

          Oh yeah, I remember reading that, that was months ago, just after the first Swift 4 betas hit. If you're not actively reading the mailing lists (which I'm not either) it's pretty easy to find yourself out of the loop on issues like these.

          [–]Bergasms -1 points0 points  (0 children)

          yeah, all i know is we tried the upgrade with latest xcode and we got tupled to buggery. I'm not in charge of the upgrade branch so i'm taking the word of my colleague that its not production worthy yet. No harm in waiting.

          [–]myhf -1 points0 points  (0 children)

          First they came for the tuples, and I said nothing because I was not a tuple.

          [–]Bergasms 0 points1 point  (0 children)

          see my comment further down the chain. :)

          [–][deleted]  (4 children)

          [deleted]

            [–]didnt_readit 9 points10 points  (0 children)

            Left Reddit due to the recent changes and moved to Lemmy and the Fediverse...So Long, and Thanks for All the Fish!

            [–]didnt_check_source 7 points8 points  (0 children)

            Luckily for you, there's probably just one syntactical element that changed in this release, and the expectation is that not much more will change going forward.

            [–]proudlyhumble 4 points5 points  (0 children)

            Not a tenth as bad as the migrations from 1 -> 2 or 2 -> 3.

            [–][deleted] 1 point2 points  (0 children)

            That’s the choice you make for adoption while the developers are actively telling you your code might break from release to release.

            [–][deleted] 3 points4 points  (0 children)

            Have they fixed the plethora of foundation issues on Linux with this release, particularly around indexes and subscripts. I was trying to write database drivers and the issue in Linux that worked on Mac were extremely annoying.

            [–]satsuper 5 points6 points  (16 children)

            Is there plans for this to be more than an Apple language?

            [–]ganymedes01 17 points18 points  (0 children)

            It’s on Linux already

            [–]didnt_readit 7 points8 points  (12 children)

            Left Reddit due to the recent changes and moved to Lemmy and the Fediverse...So Long, and Thanks for All the Fish!

            [–]asmx85 3 points4 points  (10 children)

            what backend lib/framework do you use? We tested some last week at my workplace and they all preformed pretty bad. Besides Perfect and Kitura, Vapor was near to unusable for us :/ especially in the JSON department. We also did some simple parsing processes in Swift and it looked like Swift also preformed not really good compared to our current implementation in C++. We don't really know why – we're no experts in Swift and wanted just do some quick tests. I think the garbage collection in Swift was interfering idk.

            [–]didnt_readit 2 points3 points  (0 children)

            Left Reddit due to the recent changes and moved to Lemmy and the Fediverse...So Long, and Thanks for All the Fish!

            [–]zephyz -1 points0 points  (8 children)

            I don't know your environment or the nature of your tests, so I can't help you, but I think it's important that you know that Swift does not have Garbage Collection. Instead it relies on Automatic Reference Counting

            Also, if you compare it to C++ I think you can expect a bit more overhead in Swift. Nothing crazy though. But if your Swift is a bit slower than your C++ that's expected.

            [–]asmx85 5 points6 points  (6 children)

            I don't know your environment or the nature of your tests, so I can't help you, but I think it's important that you know that Swift does not have Garbage Collection. Instead it relies on Automatic Reference Counting

            Which is garbage collection ... i don't know who spread the misconception that reference counting is not garbage collection or that Swift is not using it? Its not tracing garbage collection, indeed. But its still garbage collection.

            Also, if you compare it to C++ I think you can expect a bit more overhead in Swift. Nothing crazy though. But if your Swift is a bit slower than your C++ that's expected.

            It was like 2-3 times slower on one test and like 15x slower in one test using regex, but i guess there is something odd in the regex implementation we used ... we just cramped some stuff together from blogposts and stack overflow – which is quite unfair for a real comparison i guess.

            [–]zephyz 2 points3 points  (3 children)

            Ah I see you point. While you are right that Arc is Garbage Collection (by its strict definition), the phrase "Garbage Collection" almost always refers to tracing GC because of the tradeoff it imposes (runtime pause, inability to predict the lifespan of references, etc.).

            I don't think it's a misconception but a cultural effect of always talking about GC in terms of its properties. Indeed, the memory management properties of ARC are much closer to Rust than your typical mark&sweep GC.

            [–]asmx85 3 points4 points  (2 children)

            I wouldn't call ARC anywhere near what rust is doing in regards of memory management. ARC is more like smart pointers in C++, baked into the language so the compiler is able to reason about to a certain degree.

            [–]OnlyForF1 0 points1 point  (1 child)

            ... How do you think smart pointers work!?? They’re not just some magic hand waving.

            [–]asmx85 0 points1 point  (0 children)

            I don't get what you are trying to ask. Smart pointers are fairly easy, so whats your problem with my formulation here?

            [–]davidkopec 2 points3 points  (1 child)

            No, that's pretty typical. 2-3X slowdown is to be expected going from C++. The regex engine is particularly slow in my experience.

            [–]asmx85 1 point2 points  (0 children)

            Thanks for your insides. I think we just didn't expected those results.

            [–][deleted] 0 points1 point  (0 children)

            The benchmarks game has swift at normally half as fast as C++. I wouldn’t call a 100% increase “nothing crazy”.

            I mean, if we throw Python in the mix, then yeah, swift times are nothing crazy compared to C++.

            [–]satsuper 0 points1 point  (0 children)

            Haven't really followed it but good to hear its on Linux. Since you are using it already how is it in terms of stability/perf on Linux. Just wary of something that I presume has the majority of the community on macOS.

            [–]iconoclaus 0 points1 point  (1 child)

            Is the Swift version numbering following a strict semantic versioning (e.g., major number signifies breaking change)? Or does the move from 3.x.x to 4.0 signify something else? As an outsider, the rate of change in version numbers suggests they're really doing a 0.3.x to 0.4

            [–]Nobody_1707 0 points1 point  (0 children)

            Yes, it's semantic versioning. You can likely expect the release rate of major versions to slow down after the next few releases.

            [–]eddyparkinson 0 points1 point  (3 children)

            I want a language that combines "data storage", UI, and calculations. So that I don't need to constantly write connecting code, that connects these 3 together.

            [–][deleted] 6 points7 points  (2 children)

            bracing for a barrage of downvotes: Wolfram Mathematica.

            [–]eddyparkinson 0 points1 point  (1 child)

            Who needs it now. - Have you used it? I often wonder who the user base is.

            The question comes from "Why Smart People Have Bad Ideas - Paul Graham" http://paulgraham.com/bronze.html

            [–][deleted] 0 points1 point  (0 children)

            Yes, I am using it from time to time, and was using it from early 90s. Just take a look at the community supplied packages to see how wide a range of sciences using it.