News for hackers. Stuff that matters.
Re:Beyond Objective-C, Beyond Swift by WoodenChair on Saturday September 27, 2014 @01:15PM (#8377562)
I'm not as in love with Swift as I was when it first came out after having used it for some small hobby projects. I agree that it doesn't solve any of the big problems in software development, and more just amalgamates ideas from multiple languages (bringing them into the Cocoa world which is a good thing) and makes things safer.

However, a lot of Sinclair's arguments are misguided/misplaced/misdirected. Let me address each of his 4 core issues:

Databases & Persistence – This is almost certainly a library issue rather than a language issue. As others have pointed out, third party libraries solve this problem quite well on other platforms and there's no reason they can't be solved just as well with Swift. In fact isn't that kind've what Realm is doing?

Automated RESTful APIs - I don't think I even need to explain for the crowd here why this is a library issue and not a language issue.

Triggers & Responses – Swift actually has some rudimentary support for this in the form of Property Observers (didSet, willSet). These aren't useful for all of the same scenarios as KVO, but they're a start and I see this as an area that is clearly getting renewed attention with Swift.

UI Layout - How did he manage to criticize this issue so much and not mention Interface Builder? If you're primarily doing your layout in code, you're doing it wrong. I've been fighting AutoLayout a lot the last week, so I'm not in a mindset to give IB too much praise. AutoLayout in IB is still buggy and still has some ridiculous error messages, but I don't spend my days doing geometry calculations as he seems to imply. I'd like to see IB improvements, but again this is not a language issue.

So, it sounds like Sinclair mostly wants better libraries and better tools. Don't we all?

Re:Beyond Objective-C, Beyond Swift by chrisbuchholz on Saturday September 27, 2014 @01:39PM (#8377640)
I feel you misunderstood the article.

To my understanding, his point is that we need database persistence, automated RESTful APIs, triggers and responses and better ways to do UI layout, but what we got was Swift which doesn't address any of these things. The things we actually need.

So we end up with a new language which we have to spend time mastering, and when we are done doing that, we still need to fix those problems we had before we got Swift, so what is the point? Why do we need Swift?

That's how I read the article anyways.

Re:Beyond Objective-C, Beyond Swift by pohl on Saturday September 27, 2014 @03:30PM (#8377945)
That makes it sound as if a modern language sans the baggage of C was not needed. It was.
Re:Beyond Objective-C, Beyond Swift by mpweiher on Saturday September 27, 2014 @04:28PM (#8378110)
Hmmm...to me it makes it sound like a modern language without the baggage of C was and is needed, but Swift is not that language.
Re:Beyond Objective-C, Beyond Swift by pohl on Saturday September 27, 2014 @04:43PM (#8378151)
[language] does not solve [problems not solved by languages].

Film at 11.

Re:Beyond Objective-C, Beyond Swift by mpweiher on Saturday September 27, 2014 @04:52PM (#8378172)
Welcome to Tautology Club! If Tautology Club is the sort of thing you like, you will like Tautology Club. Alternatively, you will find that you like Tautology Club if that is the sort of thing you like.

In other news, you might have checked some of the other posts here that explain why some of these problems are, or at the very least can be language problems, before letting loose the snark.

For example https://news.ycombinator.com/item?id=8377860

Re:Beyond Objective-C, Beyond Swift by pohl on Saturday September 27, 2014 @05:05PM (#8378209)
"My smartphone didn't palliate my hemmoroids" is no tautology.
Re:Beyond Objective-C, Beyond Swift by mpweiher on Sunday September 28, 2014 @03:17AM (#8379164)
But "[language does not solve] [problems not solved by languages]" is.
Re:Beyond Objective-C, Beyond Swift by pohl on Monday September 29, 2014 @01:36PM (#8383974)
Your opinion fails to shorten my daily commute – which is the truly pressing concern.
Re:Beyond Objective-C, Beyond Swift by nbevans on Sunday September 28, 2014 @09:51PM (#8381407)
Your example is a link to yourself and two footnotes that link to articles written by yourself. Are you a joker?
Re:Beyond Objective-C, Beyond Swift by cwp on Saturday September 27, 2014 @02:17PM (#8377740)
Yes, but...

Often better libraries and tools can only be built on a better language. That's easy to say and very, very difficult to pull off, but when it happens the result is like magic.

I recently encountered this when I was getting into the nix package manager. At first I thought it was ridiculous that they had invented a whole new language just to describe packages. It was a lazy functional language at that, obviously an exercise in academic preening. Boy was I wrong. Because it's lazy you can have a program that describes a whole Linux distribution, and only run the parts that are necessary for the task at hand: installing nginx or whatever. Outside core they use all sorts of non-trendy languages, but the core is written in a new language with carefully-designed characteristics.

The result is amazing, as much of an advance as going from manual to automatic memory management.

It seems to me that the OP's complaint is that Swift wasn't designed to make better libraries and tools possible, but rather to work well with the ones we already have.

Re:Beyond Objective-C, Beyond Swift by mpweiher on Saturday September 27, 2014 @03:00PM (#8377860)
>Often better libraries and tools can only be built on a better language.

Precisely. For example, a lot of Cocoa these days relies on dictionaries and/or stringly-typed identifiers: KVC, KVO, Bindings, Archiving, CoreImage attributes, CoreData's interface to the database etc, etc. Autolayout also uses a separate string-based language.

There are a lot of problems with this approach, not the least of which are performance, code bloat and lack of any kind of compile-time checking.

Polymorphic Identifiers[1] in Objective-Smalltalk[2] are an attempt at addressing these issues (and others). The paper shows why you actually need a small amount of language support to successfully build libraries that address these issues.

I wish I could complain about how Swift's approach to these issues is so much inferior to mine (grin), but there just isn't anything at all. If anything, support for solving these sorts of problems is thinner than in Objective-C. Yikes!

Another issue is the large-scale structure of applications...their architecture: target/action, delegates, bindings (again), notifications, view-controller segues etc. are all architectural connectors, and a large part of what makes Cocoa so powerful. However, these types of connections (-> configurations) can only be described in ad-hoc ways in code, or in a different ad-hoc way in IB. Various inspectors of a GUI builder are not really the proper place to describe the overall architecture of your program.

There have been many systems/languages for describing such high-level architectures, for example ArchJava or ACME. In Swift? Crickets.

When direct language support for a feature is not present, dynamic messaging has been a great way of making library features available as if they were built-in language features. Swift makes this harder or downright impossible.

> Swift wasn't designed to make better libraries and tools possible

Yep. In fact, it's arguably a step back even compared to Objective-C. Which is sad.

> but rather to work well with the ones we already have.

Except that it doesn't really work all that well with existing ones either. Objective-C interop seems to clearly be marked "legacy", with the default apparently non-interoperability.

[1] https://www.hpi.uni-potsdam.de/hirschfeld/publications/media...

[2] http://objective.st/

Re:Beyond Objective-C, Beyond Swift by gfodor on Saturday September 27, 2014 @03:13PM (#8377897)
On the flipside, it could be that Apple is laying the groundwork (as they tend to do) to evolve these more advanced features into the language. One could imagine Swift becoming quite divergent from Objective-C in the future, but for the initial release it would have been foolish for any number of reasons to try to introduce anything other than a small step forward from Objective-C.
Re:Beyond Objective-C, Beyond Swift by mpweiher on Saturday September 27, 2014 @03:24PM (#8377925)
Yes, I was hoping for this as well, and yes, taking it in small steps is probably the right approach.

Alas, the steps Swift is taking all seem to be going in the opposite direction: more compile-time, more strictness, less dynamicism. As has been written before: Swift is not a better Objective-C, it is a better C++.

I really hope I am wrong about this, but given the current direction, the expressed philosophy and values as well as the predilections of the people involved, I don't see the direction changing from the initial vector.

Re:Beyond Objective-C, Beyond Swift by gress on Sunday September 28, 2014 @02:03PM (#8380424)
There is no less dynamicism in swift than in objective-c. What there is, is a replacement for the C. Which is precisely what they said they were going to do. C, of course is not dynamic, and the replacement is not either.

I'm not disputing the idea that instead of replacing the C, Swift's designers could have focussed on enhancing the message passing component, but I would argue that doing so without also replacing the C would have been a mistake.

Perhaps the dynamic elements will also be overhauled over time.

Re:Beyond Objective-C, Beyond Swift by mpweiher on Sunday September 28, 2014 @02:40PM (#8380540)
>There is no less dynamicism in swift than in objective-c.

Huh?

"Requiring dynamic dispatch is rarely necessary."

"The bad news is that, by default, your objects will no longer work with KVO or swizzling. If the designer of a class doesn’t anticipate a reason for a particular method or property to be dynamic, that lack of foresight gets baked in at compile time."

etc.

See http://mjtsai.com/blog/2014/08/18/its-a-coup/

If that is not correct, I'd love to hear about it!

> Swift's designers could have focussed on enhancing the message passing component,

That would have been great.

> doing so without also replacing the C would have been a mistake.

Absolutely. But really they've replaced the "Objective" and enhanced the C. After all, Objective-C is a blend of Smalltalk and C. If you remove the C, what is left?

>Perhaps the dynamic elements will also be overhauled over time.

Maybe. So far, that "overhaul" seems to be mostly de-emphasis, deprecation and removal. :-(

Re:Beyond Objective-C, Beyond Swift by gress on Sunday September 28, 2014 @03:55PM (#8380744)
Swizzling can't be mentioned with a straight face in an argument about brittleness.

But, I'll concede that KVO won't work with arbitrary properties of binary libraries you receive or that Apple builds into the platform, assuming they use swift and choose not to mark them dynamic.

So in this sole regard, swift is less dynamic.

I guess it remains to be seen whether this actually becomes a problem.

Re:Beyond Objective-C, Beyond Swift by TheOtherHobbes on Saturday September 27, 2014 @10:01PM (#8378724)
>This is almost certainly a library issue rather than a language issue.

Is Cocoa a language or a library?

IMO the criticisms really apply to Cocoa, not Swift.

Or rather - they're complaints about the fact that Swift could have been designed to simplify common Cocoa boilerplate, but instead it seems to be Yet Another Blub (c) 2014.

What's going to have more of an influence on developer productivity - a novel type inference scheme, or an OS API that works so well you don't need to keep writing the same boilerplate over and over, or go looking for 3rd party libraries to fix its deficiencies?

Re:Beyond Objective-C, Beyond Swift by rjsamson on Saturday September 27, 2014 @01:34PM (#8377624)
Agreed, DB & Persistence and automated restful APIs are library problems, and ones pretty well solved by some existing solutions. Realm is awesome, and solves both pretty well.

Personally, I love Swift, and after having written a medium sized application in Swift over the course of about a month, I can say I saw significant productivity gains over objective-c.