
What's New in Swift 4 - astigsen
https://academy.realm.io/posts/daniel-steinberg-whats-new-in-swift-4/
======
melling
Swift has evolved quickly, and it has finally been large adopted by the iOS
community:

[https://www.tiobe.com/tiobe-index/](https://www.tiobe.com/tiobe-index/)

What’s missing is non-Apple adoption. I’m hoping Swift becomes an
acceptable/competive option on other platforms.

~~~
mozumder
How easy is it to build a Swift app that uses the same codebase for Mac,
Windows, and Android?

What are the target environments like in non-Apple systems?

~~~
ash_gti
Its not terribly difficult to use swift on linux, theres a a working group
trying make it easier for developers to use swift on the server [0]

[0] [https://github.com/swift-server/work-group](https://github.com/swift-
server/work-group)

~~~
dvfjsdhgfv
Yes, but the main question is: what for? You can't use it even to do what it's
been created for: writing iOS apps (maybe some backend modules if you're
obstinate enough). There is a great choice of languages in Linux with rich
libraries and vibrant communities - why on Earth should I choose Swift?

~~~
ash_gti
I'm an iOS developer and I use it for writing iOS apps, testing, and managing
my test environments. I have the luxury of assuming a macOS host though.

I think the reason you'd pick it for a server language is because the
strengths of the language and ecosystem meet your server requirements.

------
binaryapparatus
I really tried couple of times to use swift in production. One of my MAS apps
is pure swift. However I can't force myself to like it. Maybe I am missing
some brilliant part of it that I missed but I just can't love it.

~~~
swah
What do you love? I can't love Go as a language, but love the projects,
standard library, community, and have no replacement yet for the space where
Go is.

~~~
binaryapparatus
I went trough C and Pascal some 30 years ago and still prefer C above anything
else. Objective C obviously being close enough so I can write efficient (or at
least visually pleasing code). Last straw with Swift for me was banishing of
++ operator. C has beauty and smartness to write _a lot_ of code in one line.
I don't like C++ that much.

Anything that makes code beautiful works for me. Swift somehow can't be
per_line_efficient and aesthetically pleasing to me.

~~~
melling
Sounds like you like what you’re used to. What do you mean by per line
efficient? C and Objective C are more verbose. Declaring non-null, implicit
types, and immutable in Swift is a big plus.

let x = “Hello world”

var isDone = false

Filtering an array in one line is much nicer than a for loop:

let newList = anArray.filter(...)

No header files reduces code significantly.

~~~
binaryapparatus
For instance tight while loop with ++ increments where needed. You can't do
that in Swift. Or one liner if in the middle of other code.

I am using a lot of different languages so 'what I am used to' means lots of
different stuff. Ruby has some of C beauty. Python does not. Haskell is
probably most beautiful of them all. All individual and from my point of view
of course.

~~~
melling
Perhaps you can be less abstract and illustrate your point with sample code.
In most comparisons, Swift looks a lot nicer.

[https://h4labs.wordpress.com/2016/02/09/should-i-use-
objecti...](https://h4labs.wordpress.com/2016/02/09/should-i-use-objective-c-
or-swift-for-writing-ios-apps/)

The ++ operator was removed from Swift. Haskell uses ++ for concatenation. The
case where ++ to add 1 is desirable occurs much less often than a variable
declaration, which is better in Swift.

~~~
binaryapparatus
For instance C copy routine:

    
    
      while (*d++ = *s++);
    

Or sort in Haskell:

    
    
      qsort []     = []
      qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)

~~~
melling
What’s the value of the Haskell code? It’s a great language but not really
supported on iOS. Would love for it to be.

Back to the one idiomatic C example. The few places where it’s terse does not
make up for the many other places where it’s not. You also have memory
management with malloc for additional code. If you compare nontrivial code,
Swift is a more modern, safer, less verbose, etc way to develop iOS apps vs
Objective C.

~~~
binaryapparatus
Swift wants to be much more than just iOS specific language so it is fair to
compare its pros and cons with other general purpose languages. If you look at
iOS only then there is not much to compare to, just ObjC and few JS
abominations. Staying iOS specific is not what Swift wants to be.

------
euyyn
> Swift 4 is the release that says, “We need to stabilize the source code.”

Stabilizing source code doesn't have any meaning that I know of. But the
updates to the language and library are good!

Looking forward to what they come up with regarding ownership semantics.

~~~
pohl
_Stabilizing source code doesn 't have any meaning that I know of._

Programs written in Swift 4 will compile under the Swift 5 compiler, etc.

~~~
euyyn
Oh, source code compatibility for real? That's super nice!

------
agumonkey
since they're keen on intervals I wonder if they'll provide interval algebra

    
    
        if a..b ∩ ..<c:

