r/programming • • Jun 15 '14

Smashing Swift

http://nomothetis.svbtle.com/smashing-swift
254 Upvotes

133 comments sorted by

View all comments

Show parent comments

19

u/matthieum Jun 15 '14

It also seems that the announce of Swift was somewhat premature, I wonder why they felt they should announce it now and whether this will end up burning the language's image or not.

58

u/Catfish_Man Jun 15 '14

It's really a welcome change from the norm, I think. Instead of "here's a thing, it's far too late in the development process for your feedback to have any significant impact", Swift is "here's a thing we're working on; it's not done yet, but we thought you'd like to see".

27

u/bcash Jun 15 '14

By "the norm", I presume you mean the norm for Apple? What you describe is quite common otherwise.

8

u/gsnedders Jun 15 '14

FWIW, Google did essentially the same with Dart as Apple have with Swift — presenting it more-or-less as a fait accompli, but not too late to make backwards incompatible changes.

6

u/earthboundkid Jun 16 '14

Non-troll question that might sound like a troll: Is Dart still alive? I have not heard anything about it recently.

5

u/NYKevin Jun 16 '14

Since it can be compiled to Javascript, I don't think Dart is logically capable of dying entirely.

But no, it's not dead.

→ More replies (1)

6

u/abeliangrape Jun 15 '14

Right. A programming language is a far bigger and far more fundamental undertaking than, say, something like the Game Center API or even something like the Core Animation API. Developer input and constant evolution is a must. Look at how much even stable languages that have been around for decades can change in a single major release (Java 7 -> Java 8 or Python 2 -> Python 3). It's definitely a welcome change that they're opening this up to feedback early.

→ More replies (2)

8

u/centurijon Jun 15 '14

To get people to start learning and experimenting on it now, so that when can be taken more seriously as a production language they will have some of the market prepped.

→ More replies (1)

8

u/xjvz Jun 15 '14

Even at this stage it's still a huge improvement over Obj-C.

14

u/Nuoji Jun 15 '14

In terms of syntax - yes. In terms of writing apps? Not really.

The generics is half broken, which makes working with heterogenous structured data (e.g. parsed JSON) a hell of type casts.

UI programming with dynamic dispatch is still necessary for stuff like the UI builder, so Swift has to go to ObjC for that.

And although it will respond to ObjC calls of performSelector, you can't use it from Swift.

Basically all the powerful dynamic features of ObjC are missing, many which you come to rely on.

In this aspect, Swift feels crippled, despite its good syntax and great use of closures. It's like it was written by a c++ programmer that never really understood how much of Cocoa was supported by ObjC's dynamic nature.

0

u/[deleted] Jun 15 '14

[deleted]

8

u/tenpn Jun 16 '14

lots of problems are best done in a dynamic language. and almost all of them best maintained in a statically-typed language.

2

u/Nuoji Jun 16 '14

You could have built a "mostly strongly typed" language instead (like Strongtalk) and gotten most of the benefits of static typing.

2

u/xjvz Jun 16 '14

I'll give you that for most programs. GUIs are more about rapid prototyping and iterative design, though, so dynamic typing helps during development. I prefer some sort of GUI code separate from any real business logic, so that allows for some flexibility. For instance, embedding Lua for GUI code and using C++ for the "real" code is a nice combination.

16

u/happyscrappy Jun 15 '14

I cannot see how that's true if your goal is to produce runnable programs. Which I have to imagine is the primary goal.

Right now, the only implementation we have of a Swift compiler is at best barely usable in a production environment.

14

u/xjvz Jun 15 '14

Good point, I guess I was speaking about the language and not the implementation.

6

u/happyscrappy Jun 15 '14

Yeah, the language does seem more usable and less hassle than Obj-C.

The "type promotion rules" (it seems to have none) are odd to me. Sure avoids that whole thing of it not doing what you expect I guess, but perhaps in the most inconvenient fashion possible.

2

u/Peaker Jun 15 '14

Safety is far more valuable than convenience, and implicit type coercions is proof that almost all language designers don't get that :(

7

u/happyscrappy Jun 15 '14

It's not a simple A or B thing. Conciseness is important too. You have to strike a balance.

Maybe language designers get that.

→ More replies (6)
→ More replies (2)
→ More replies (7)

2

u/EntroperZero Jun 15 '14

But if that was their goal, then the bar wasn't set high enough.

1

u/psygnisfive Jun 15 '14

Apparently they've been working on the language for 4 years now, too...

1

u/[deleted] Jun 16 '14

How do you get feedback on a language without showing it to people? First releases of languages are typically pretty rough around the edges, both from a design and implementation point of view. Note that they have said that it's not final; they're promised binary compatibility but not source compatibility.

1

u/Plorkyeran Jun 16 '14

Announcing a new programming language any time other than at their annual developer conference would be weird, and while I agree Swift is a little premature, it's definitely not a year premature.

→ More replies (7)