Live data from Hacker News

Server APIs Project

swift.org

51–60 of 181 posts

Re: Server APIs Project

#51
post #50
post #35

Earlier quoted context omitted.

Swift was influenced by Scala, so that's no surprise.

Obligatory comparison: https://leverich.github.io/swiftislikescala/

Wow. They're basically identical. Scala has a bit less boilerplate sometimes, but it's also older, so I guess Swift will get syntactical sugar to catch up in time.

Re: Server APIs Project

#52
post #30

What editor is everyone using for Swift? Last time I played with Swift I stopped after XCode crashed 2 times in an hour for me. It is also very slow. But none other editors seem to support auto completion which is a deal-breaker for me. Without it it's hard to consume all the APIs. I hope Apple can follow Rust's path by making a language server[0] for Swift, if Apple is serious about providing cross-platform support…

Last time I messed with Swift, I was using a vim plugin based on SourceKitten[1] but it was a couple months ago over a weekend and I honestly can't remember how well it worked. If you were inclined, it seems like it'd get you most of the way to a language server.

[1] https://github.com/jpsim/SourceKitten

Re: Server APIs Project

#53
post #9

Great. Great great great. A thousand times great. We've been slowly converting our iOS projects over to Swift over the past year and the results have been tremendous (a ~40% drop in LOC from ObjC, among many other benefits). Really the only language-level feature that feels missing for server development is first-class support for asynchronous/concurrent operations, but that's coming. Swift is truly a 'best of most w…

Also a significant drop in null dereferencing issues. The `if-let` syntax is brilliant.

Not as general or useful as Rust's "if let", though. Rust's "if let" affords fallible pattern matching on arbitrary types, not just on "nullable pointer types" (in Safe Rust, a "nullable pointer" is simply a regular reference wrapped in Option).

Re: Server APIs Project

#54
post #51
post #50

Earlier quoted context omitted.

Obligatory comparison: https://leverich.github.io/swiftislikescala/

Wow. They're basically identical. Scala has a bit less boilerplate sometimes, but it's also older, so I guess Swift will get syntactical sugar to catch up in time.

No, it's a lot like Groovy:

http://glaforge.appspot.com/article/apple-s-swift-programmin...

No, it's a lot like C#:

http://swiftcomparsion.qiniudn.com

Re: Server APIs Project

#55
post #32
post #24

Earlier quoted context omitted.

OS/2 had its own version of COM, called SOM. The best thing about it, was that it also supported metaclasses Smalltalk style. So one could go crazy with OO metaprogramming. Sadly it died with OS/2. Then there was the other multi-platform OO ABI project from Apple, Sun and IBM, Taligent. Also not that successful. COM is ok to work with, when done from .NET or now UWP point of view. C++/CX and the recently announced C+…

I've mostly used COM from .NET, and as you said, it's fairly painless. At one point, we were having issues with a COM DLL we were using from .NET, so I thought it might be fun and useful to dive in and learn more about COM. I bought Don Box's COM book, and tackled COM in Plain C : http://www.codeproject.com/Articles/13601/COM-in-plain-C It was somewhat less fun than I'd hoped it would be. XPCOM seems to be (somewhat)…

I still go back and dip into Essential COM now and again. I bought my copy because I was involved with a project to build a COM/CORBA bridge and needed to get my head around COM's infrastructure. Also back in the day I used to write a lot of code that ran under Microsoft Transaction Server (MTS) and COM+.

Another interesting book by Mr Box and co-authored by Chris Sells, purely from a historical perspective now as it's fairly ancient, is Essential .NET Vol. 1[0]. Sadly they never got around to writing a second volume.

As a humourous aside, who remembers Don's lecture he did from a bath tub?:

https://blog.mattmags.com/2011/05/19/don-box-the-bathtub-lec...

[0]: https://www.amazon.co.uk/dp/0201734117

Re: Server APIs Project

#56

Earlier quoted context omitted.

Also a significant drop in null dereferencing issues. The `if-let` syntax is brilliant.

Not as general or useful as Rust's "if let", though. Rust's "if let" affords fallible pattern matching on arbitrary types, not just on "nullable pointer types" (in Safe Rust, a "nullable pointer" is simply a regular reference wrapped in Option ).

Swift has "if case let" for that use case. (Admittedly, the syntax is a bit esoteric.)

Re: Server APIs Project

#57
post #50
post #35

Earlier quoted context omitted.

Swift was influenced by Scala, so that's no surprise.

Obligatory comparison: https://leverich.github.io/swiftislikescala/

Some of these comparisons aren't great. The "Variable Number Of Arguments" example is better expressed in Swift with "reduce", and it's really comparing "summing an array", the varargs aspect is a minor detail of the example. The "Idiomatic Scala" example doesn't even declare a function with varargs! (yes, it uses one, but that's not really the point)

The Swift function in the protocols example doesn't need to be generic, as the protocol doesn't have any associated types, and really ought to be a protocol extension regardless.

Re: Server APIs Project

#58
post #50
post #35

Earlier quoted context omitted.

Swift was influenced by Scala, so that's no surprise.

Obligatory comparison: https://leverich.github.io/swiftislikescala/

The comparison should be updated to Swift 3. Swift syntax is more intuitive and readable than Scala. A common mistake in language design is to depart from C syntax, without substantial gain. For example, replacing {}, &&, || with other things. Swift strikes a great balance between intuition and innovation.

Re: Server APIs Project

#59
post #30

What editor is everyone using for Swift? Last time I played with Swift I stopped after XCode crashed 2 times in an hour for me. It is also very slow. But none other editors seem to support auto completion which is a deal-breaker for me. Without it it's hard to consume all the APIs. I hope Apple can follow Rust's path by making a language server[0] for Swift, if Apple is serious about providing cross-platform support…

SoureKit, which seems to drive a lot of the Xcode Swift features, is open source: https://github.com/apple/swift/tree/master/tools/SourceKit

Re: Server APIs Project

#60
post #28
post #9

Great. Great great great. A thousand times great. We've been slowly converting our iOS projects over to Swift over the past year and the results have been tremendous (a ~40% drop in LOC from ObjC, among many other benefits). Really the only language-level feature that feels missing for server development is first-class support for asynchronous/concurrent operations, but that's coming. Swift is truly a 'best of most w…

Swift lines of code take about 10x more time to compile compared to obj-c too. I wished for obj-c when our project started passing the ~70 kloc mark.

Remember that the Swift compiler is way smarter than Objective-C's. Given how dynamic the language is compared to Swift, Objective-C can make very few decisions at compile-time (inlining, static binding, de-virtualization, strict type checking, etc.).

It can definitely get faster than it is now, but it is always going to be doing much more work than an Objective-C compiler.

Post reply on HN