Live data from Hacker News

Swift's Evolution

carpeaqua.com

71–80 of 105 posts

Re: Swift's Evolution

#71
post #21

And I thought 2017 is the year when I start a new app in swift... guess will be sticking to objc and react native depending on what makes sense where.

as much as I like swift, wait for it to become stable. Don't subject yourself to the pain yet. That said do take advantage of using literally all the things that have been added to Objective-C for compatibility as they provide useful information and diagnostics.

It is stable. I would wager that more people are building professional apps in Swift today than Objective C.

Re: Swift's Evolution

#72

The author mentions that Apple often nudge their idea of the future forward each year at WWDC. I see no different with Swift: the introduction of Playgrounds, teaching resources, finesse over small details, etc - to me indicate Apple wants to make this a language that the next generation of developers grow up learning and using. Quite a good move on their part if it is successful. If kids start learning Swift at scho…

"Quite a good move on their part if it is successful."

I haven't used it, nor do I work in education, but what I have read of it, it at least is successful in the sense that those who use Apple's Swift training material find it to have good quality.

For example, http://www.speirs.org/blog/2017/6/1/a-year-of-teaching-swift:

"In times past the experience was that, if you were an able student in Computing, you would get your programs working. If you were not an able student, your experience would be almost insurmountable challenges to get anything working. Working or not-working was the differentiator in the class.

In the Learn to Code curriculum, I found that everyone got something working. The difference between the stronger students and the weaker students then was more to do with evaluations of the complexity of their solution, the understandability and style of their solutions or other factors like memory and time efficiency.

I have never really had these kinds of conversations in classes at this level before. It has been an incredibly satisfying year to get the opportunity to debate which of three possible solutions is the 'best' for a given problem and, further, what definition of 'best' we should accept."

It also is good to see that Apple expands its offering. https://www.apple.com/newsroom/2017/06/swift-playgrounds-exp...:

"Apple is working with leading device makers to make it easy to connect to Bluetooth-enabled robots within the Swift Playgrounds app, allowing kids to program and control popular devices, including LEGO MINDSTORMS Education EV3, the Sphero SPRK+, Parrot drones and more. The Swift Playgrounds 1.5 update will be available as a free download on the App Store beginning Monday, June 5."

Re: Swift's Evolution

#73
post #70

Earlier quoted context omitted.

Because Swift 1.0 was far superior to Objective C in maintainability and code quality. Now I do admit the build times were awful and I had a couple puzzling crashers that were only cleaned up by Swift 1.2 (thankfully didn't ship till after 1.2 was final), but the transition was worth it.

> Because Swift 1.0 was far superior to Objective C in maintainability and code quality. You can take Objective-C code written three years ago, open it up in Xcode today, and compile it. The same cannot be said for Swift. So saying Swift 1.0 was "far superior" in terms of maintainability is a bit of a stretch, in my opinion.

Sure, in the edge case where you actually don't maintain code except for once every three years, it's closer. But even in that example, after a couple bad hours/days (given size of your project) updating your swift code, you then have many good days working in much more readable code.

Re: Swift's Evolution

#74
post #48
post #16

I'm actually pretty happy swift moves the server side story forward, because i'm convinced the "next big language" will have to run on mobile and server. Actually, i think they don't go fast enough, especially regarding concurrency ( which on the server goes beyond just providing async await, as lattner said they were aiming at something closer to the actor model). I don't think the "maybe objc is still relevant for…

> which on the server goes beyond just providing async await, as lattner said they were aiming at something closer to the actor model I'd be interested in further information about this, if you can share some link here.

http://researcher.watson.ibm.com/researcher/files/us-lmandel..., page 52:

"Async/await are effectively proven at this point and would fit well with the Swift type system and structure, we should probably just do it.

Erlang/Akka have proven actor models. Swift providing syntax yields a declarative model which enables programmers to reason about what mutable state goes with each task. Each actor is effectively a DispatchQueue + state it manages + operations that act on it.

Actor approach also generalizes well to future. It could be a great way for handling heterogenous compute (e.g. GPU tasks), distributed compute, etc since each async “call” to an actor really is a message send (thus could be DMA or IPC)."

I don't think a video of that talk is available online. https://researcher.watson.ibm.com/researcher/view_group_subp... doesn't mention it.

Re: Swift's Evolution

#75
"Apple's path with Swift doesn't seem to solve the problems I have as a day-to-day iOS developer. "

That's the key take-away for me.

Of course Swift has an easier time with some syntactic issues than Objective-C, which is two languages crashed into each other. And yes, Objective-C was way, way overdue for a better replacement. Heck, just dropping the "C" part from the language syntax and reducing it to type annotations in a nice typed Smalltalk (see Strongtalk, or TS) would have fit the bill.

It's not as if there aren't lots of problems (and your list will almost certainly be different). For example, applications are no longer just code, non-code resources are just as important, but support for them is at best rudimentary. So with pluggable scheme handlers and polymorphic identifiers, we could write

    checkBoxImage := img:checkbox.
And have the "img" scheme handler statically check resource availability against a list automatically imported from Xcode's resources (pluggable, see F# type providers). Of course, the internet also happened, so

    shoppingPage := http://amazon.com/
should also work, because why should obtaining resources outside your machine have so much extra ceremony. Abstracting should of course also work:

    scheme:amazon := ref:http://amazon.com asScheme
    shoppingPage := amazon:/
And of course you can compose scheme handlers, so you add JSON or XML decoding and then use the resulting scheme handlers as if the original data source

Then there is keeping UI and model in sync. There were bindings, but these were hacky, somewhat unreliably, undebuggable etc. Much better to generalize and integrate a constraint mechanism into the language:

    -setupTemperatureConverter
    {
        ivar:f |= (9.0/5.0) * ivar:c + 32 .
        ivar:c |= (ivar:f - 32) * (5.0/9.0).
        ivar:k |= ivar:c + 273.
        ivar:c |= ivar:k - 273.


        ivar:c =|= ivar:celsiusTextField/intValue.
        ivar:f =|= ivar:fahrenheitTextField/intValue. 
        ivar:k =|= ivar:kelvinTextField/intValue. 
    }
That's actual code for a temperature converter app, setting up relationships that get automatically maintained. And if you make constraint handling support pluggable as you should, you also have a proper syntax for writing autolayout constraints. And Makefiles.

Together with composable scheme handlers (see above), this gets rid of the vast majority of your view controller code.

Then there's the nib vs code dance. Or storyboards. All semi-solutions to problems that are largely (but not entirely) architectural in nature. All can be aided tremendously by good linguistic support, putting to rest many of the recurring problems we have with these technologies (or conversely with not adopting them).

Swift does nothing for any of this.

Re: Swift's Evolution

#76
post #58
post #50

Earlier quoted context omitted.

It's fine if you don't mind using rudimentary, buggy tools, and converting your whole code base to the latest language changes every 6 months, and you don't mind bloating your app with a mandatory 8Mb runtime. Great for small projects, people coding for fun, learners, and early adopters/neophiles who enjoy keeping up with all the changes. But substantial projects need solid, stable tools. Swift will get there very so…

Great for small projects, people coding for fun, learners, and early adopters/neophiles who enjoy keeping up with all the changes. But substantial projects need solid, stable tools. Lots of projects more important and substantial than anything you and I have worked on have been shipped with Swift. So that argument doesn't really fly. Apps redone/adopting Swift include Twitter, Pandora, Groupon, Fitbit, etc. (Heck, ma…

That just shows that big companies can have poor judgment too.

Re: Swift's Evolution

#77
post #50

Earlier quoted context omitted.

It's fine if you don't mind using rudimentary, buggy tools, and converting your whole code base to the latest language changes every 6 months, and you don't mind bloating your app with a mandatory 8Mb runtime. Great for small projects, people coding for fun, learners, and early adopters/neophiles who enjoy keeping up with all the changes. But substantial projects need solid, stable tools. Swift will get there very so…

I shipped my first Swift App with version 1.2, and have written or helped write a half dozen since. Anyone who is still using Objective C and dealing with dangling pointer bugs and difficult to maintain code is missing the point that most software development is bug fixing and maintenance. I never have the IDE crash and haven't for the last year+, never have problems with compiler bugs. Autocomplete is fine, compile…

In what ways is objC difficult to maintain, and in what ways is Swift easier to maintain than objC?

I look forward to the magical bug free future when I switch to Swift.

Re: Swift's Evolution

#78
post #70

Earlier quoted context omitted.

> Because Swift 1.0 was far superior to Objective C in maintainability and code quality. You can take Objective-C code written three years ago, open it up in Xcode today, and compile it. The same cannot be said for Swift. So saying Swift 1.0 was "far superior" in terms of maintainability is a bit of a stretch, in my opinion.

Sure, in the edge case where you actually don't maintain code except for once every three years, it's closer. But even in that example, after a couple bad hours/days (given size of your project) updating your swift code, you then have many good days working in much more readable code.

[deleted]

Re: Swift's Evolution

#79
Nothing wrong with swift but the build tool team. I can tolerate method name convention that always changing. And also still not support async await.

Xcode build tool is the worst. Compiler time is the most hurt. Very slow. Android, react and xamarin already support hot swap compile.

Migration tool is not working. I'm not sure this year xcode able to refactoring rename method

Re: Swift's Evolution

#80
post #44

Earlier quoted context omitted.

Why isn't it currently ready for production use? ABI stability is the only real issue I can see now.

I'd say it's ready, but it's a bit iffy because of the tooling. The compiler is way too easy to crash, the debugger is often worse than useless, and larger projects can be extremely slow to build. You can put up with these, and I think it's worth the tradeoff, but you should definitely consider them carefully before putting a lot of effort into build a real-world Swift code base.

> larger projects can be extremely slow to build

Ironically this forced me to start using Swift Package Manager more and to split my projects into frameworks.

Post reply on HN