Live data from Hacker News

The Swift Programming Language

developer.apple.com

551–560 of 970 posts

Re: The Swift Programming Language

#552
post #397

Earlier quoted context omitted.

I never understood what the fuss was all about either. If you know one other language really well, Objective-C should take a week or two to get use to. To understand all the design patters, apple HIG, XCode, profiling, libraries, debugging, app submission, etc, these combined is where youll sink your time to learn iOS development. Imo, Objective-C is the easy part.

I recently translated one of my Apps from Android to iPhone. I had 0 objective-C experience, but I made it work. It was a bit of a frustrating experience. Many times I found myself writing Objective-C boilerplate-ish code that I had 0 clue what it was doing, considering this is a hobby / for fun project I just wanted it working. It's not easy to google the answer to, "Why did I just add this new keyword after this co…

You may know what a constructor is, but maybe not know what a designated initializer does. ;-)

Re: The Swift Programming Language

#553
post #162

Earlier quoted context omitted.

Correct me if i'm wrong, but Swift has static typing (with type inference, but still with a strict type on every variable), whereas Objective C has dynamic typing with optional type annotations. Having ubiquitous strong type information available should make it much easier to generate fast code.

Hm, maybe that's it. I thought typing was still dynamic because of the multiple return types.

guessing multiple return types are supported by just returning a tuple?

Re: The Swift Programming Language

#554
post #497

Earlier quoted context omitted.

Heartbleed. Majority of all SSL keys on the internet compromised. All ~2 billion of humans on the internet required to change their passwords due to a single mistake by a single programmer using C. That's billions of human beings wasting hours either changing all their passwords or having their money, identities, medical records, and more stolen because they didn't. Having their accounts hijacked. For all we know tot…

It is unethical to continue writing code in non-memory-safe C or C-based languages, for any purpose. Period. I'm looking forward to seeing your new operating system and managed runtime written entirely using garbage-collected languages!

I don't necessarily agree with the post you're replying to, but Rust is a memory-safe language without any garbage collection whatsoever. Proper unique pointers and move semantics are basically magic.

Re: The Swift Programming Language

#555

Nothing about concurrency. Nice. STOP MAKING NEW LANGUAGES!!! This is like environment pollution and should be shunned.

I didn't see anything justifying:

> Swift is the result of the latest research on programming languages

What research? The Apple marketing went a little overboard here.

I know Objective-C is subjectively bad from trying to use it. Swift is a step up and that's the exciting part. That's a good thing for ios development.

Re: The Swift Programming Language

#556
post #432

Earlier quoted context omitted.

I really don't see the Golang influence at all. The multiple- return- value semantic is closer to Ruby's than to Golang's; you're returning a tuple, which happens to have natural syntax in the language. Defining Golang features that don't exist in Swift: - Interface types with implicit adoption (Swift takes explicit protocols from ObjC) - Error types - Relatedly, the "damnable use requirement" and its interaction wit…

> - Interface types with implicit adoption (Swift takes explicit protocols from ObjC) Objective-C has informal protocols, and so does Swift.

I'm assuming OP means structural typing, which Objective-C does not support.

Re: The Swift Programming Language

#558
post #536

One question to the audience : i've had a look at the swift iBook and noticed that dictionary are strongly typed. Which is great in a way, but now i wonder : how would you create a json deserializer ( which conveniently deserialized into NSArray and NSDictionnary of anything ) ? I didn't see any "object" or "id" type equivalent.

There is a special type called AnyObject that represents Objective-C id values

Re: The Swift Programming Language

#559
post #355

Earlier quoted context omitted.

"93x faster" sounds roughly like a 46.5x improvement in marketing.

It's not only possible, it's even not uncommon for a C programmer to get a 90X improvement in speed in their own C program. If you have naive memory management, or incorrectly implemented concurrency or parallelism, you can easily lose 2 orders of magnitude speed.

This. In my case a 1Mbyte memcpy in the middle of a loop this morning. Enough to blow the CPU cache out of the water...

300x improvement instantly by moving it out of the loop.

Re: The Swift Programming Language

#560

Earlier quoted context omitted.

I don't get the hate. Yeah, syntax is unfamiliar, bu once I got used to it I began to really enjoy objective-c. Ymmv etc., but it's now one of my fav languages - though I guess this is mostly due to cocoa

My dislike is that it uses [] for method calls. It's like making Objective-English where we swap Z and A and j for o, just for the hell of it. If thzt sjunds like fun tj yju, thzn gj fjr Jboective-C.

It's not for the hell of it.

[ ] does not mean method call, it is the syntax for a message send.

Objective-C is a super set of C, adding an Smalltalk like object system to C. The delimiters say "I am sending a message", which is different to a method call. Also, without them the language would be much more difficult to parse, and future changes to C could break the language. It's lasted well (first appeared in 1993). Not as long as Lisp, perhaps it needs more [ ] :)

Post reply on HN