Live data from Hacker News

The Swift Programming Language

developer.apple.com

621–630 of 970 posts

Re: The Swift Programming Language

#622
post #612
post #559

Earlier quoted context omitted.

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.

Are you sure it wasn't just because you were then no longer doing a large memcpy repeatedly?

Yes it was entirely covered by that :)

I think it was covered by "naive memory management" and "shitty outsourcing". I'm paid to fix their stuff.

Re: The Swift Programming Language

#623
post #2

As someone who always disliked Objective C, I think Swift looks very promising. I'll check it out right away :) Software-wise, I feel these current WWDC announcements are the most exciting in years. Looking at the Swift docs right now, I can see many interesting inspirations at work: there's some Lua/Go in there (multiple return values), some Ruby (closure passed as the last argument to a function can appear immediat…

Is it realistic to try to dive right in to the 500-page book they provided without a computer science background, just HTML/CSS/PHP self-taught experience, to learn the language? Or should I take other steps first?

Just read the first paragraph and conclusions if the have them, of each chapter. This will give you a good idea of what's there when you need it. Then I'd jump straight into tutorials.

Honestly skimming 500 doesn't sound horribly hard to me. I've done that a few times to pick up something new. As ap said you won't learn the language like that but you will have a good reference to go and learn from after the fact.

After that you could probably work through the examples in said book, or at least the interesting ones.

P.S. above steps is all I really learnt from my cs degree.

Re: The Swift Programming Language

#625

Ok, what about runtime support for older devices/iOS versions? They didn't say anything about it.

I wrote a test app with the newest Xcode and simulator. It does work with iOS 7, with iPad Air, iPhone 4s, iPhone5, etc. I would imagine that it will support at least 6.0 and maybe even back to 5.0.

EDIT: Tested with 6.x and works.

Re: The Swift Programming Language

#626

Earlier quoted context omitted.

Checkout Scala worksheets (Eclipse and IDEA) and LightTable too.

Yeah.. Because Scala doesn't have a metric ton of problems. AVOID!

Scala doesn't have a metric ton of problems. It has some problems, sure, but it has a lot of nice features as well.

Re: The Swift Programming Language

#627

I'm reading the manual and liking nearly everything. But then I stumble across: > Alternatively, remove a key-value pair from a dictionary with the removeValueForKey method. Is that the day where an Objective-C got to choose method names? Why not dict.delete() or similar?

I’m with you, and that’s one thing I really don’t appreciate about Obj-C and Apple APIs. You find yourself looking at classes with names like UICollectionViewDelegateFlowLayout and methods called minimumLineSpacingForSectiontAtIndex.

I’m not a one-character variable name type of person, but this makes my fingers (and my brain) ache, and for me makes the code harder to comprehend (wood for the trees, I guess, or something like that)

Re: The Swift Programming Language

#628
post #611
post #419

Reading people compare Swift to other languages is pretty hilarious. OCaml.. Haskell.. CoffeeScript.. Ruby.. Go... Kotlin... JavaScript.. Scala... No one is saying it so I will: It looks like damn Java 8. It is probably not a good sign that it can be immediately compared to every modern (and not so modern) language in existence.

And Swift seems to resemble another Apple language Dylan, which was based on Scheme/Lisp. All languages since the are in trouble! I really like that it is incorporating good parts of many, more terse languages. Nothing wrong with selectively absorbing good ideas. But a huge part is the interactive nature. I dabbled in Smalltalk some years ago and have been annoyed at compiled languages ever since, resorting to things…

It does look a bit like Dylan. I wonder if it has more than a passing resemblance. Also I wonder if they are doing SBCL real time compelling.

Re: The Swift Programming Language

#629
post #2

As someone who always disliked Objective C, I think Swift looks very promising. I'll check it out right away :) Software-wise, I feel these current WWDC announcements are the most exciting in years. Looking at the Swift docs right now, I can see many interesting inspirations at work: there's some Lua/Go in there (multiple return values), some Ruby (closure passed as the last argument to a function can appear immediat…

> It has the concept of explicitly capturing variables from the surrounding context inside closures, like PHP does, instead of keeping the entire context alive forever like Ruby or JS.

Just as a point of fact, javascript -- at least the v8 implementation I'm most knowledgeable of -- doesn't "keep the entire context alive forever." Only variables used in the closure are allocated into the closure (i.e. on the heap), the others are allocated on the stack and disappear as soon as the function returns.

I don't use iTunes so can't read their book, but I wanted to ask: you say that ARC is still their GC strategy, correct? So reference cycles are still an issue? I'm surprised at this. I can see reference counting being a strategy for moving a non-GC'd language to GC (like Objective-C), but to start a new language with that constraint is surprising.

Re: The Swift Programming Language

#630
post #547

Earlier quoted context omitted.

From a user's point of view, it's basically straight out of the Rust book, all the gravy with also relaxed ownership and syntax. It has it all [1]: static typing, type inference, explicit mutability, closures, pattern matching, optionals (with own syntax! also "any"), generics, interfaces, weak ownership, tuples, plus other nifty things like shorthand syntax, final and explicit override... It screams "modern!", has a…

Indeed, I'm not sure what Swift's concurrency story is yet. Other than that it's encouragingly similar to Rust (we're evolving in the right direction!), but not quite as low-level.

The similarity to Rust should scare the hell out of Rust's creators and proponents.

Swift could very well render Rust almost totally irrelevant within the OS X and iOS sphere of software development. If we end up eventually seeing Swift implemented for other platforms, then the chances of Rust's long-term success diminish even more.

Things might have been different had a stable, even if somewhat imperfect, initial version of Rust had been released by now, thus allowing it to gain some adoption and traction.

I hope that the "But Rust isn't targeting those developers!" argument isn't used to try to justify this mistake, as well. Rust is already facing stiff competition from languages like Go, C++11, C++14, Scala and even Java 8.

With the announcement of Swift, Rust's niche and audience are getting smaller, further preventing the widespread adoption that's necessary for a programming language to become truly successful.

Post reply on HN