Live data from Hacker News

The Swift Programming Language

developer.apple.com

321–330 of 970 posts

Re: The Swift Programming Language

#321
post #256
post #88

Unicode variables, I love it: let 🐶🐮 = "dogcow" Moof!

You can do this in C# (and presumably other languages). I've seen people using Greek symbols in mathy code before. It's kind of fun.

It's fun once. It's impractical for someone editing the code later though, I don't want to have to look up the unicode character each time I want to remember it, and I don't want to have to copy and paste it either, it's better to stick with the characters available on a keyboard.

Re: The Swift Programming Language

#322

I just skimmed the tour, and my impression is: Swift is a compiled, Objective-C compatible Javascript-alike with an ObjC-like object model, generics, and string interpolation. No exceptions. Based on LLVM and appears to inherit the same data structures as Cocoa apps (Dictionaries, Arrays, &c). It feels very lightweight, sort of like an analog to what Javascript is in a browser.

Dictionary isn’t NSDictionary or NSMutableDictionary because of type inference issues (“they can use any kind of object as their keys and values and do not provide any information about the nature of these objects”).

Re: The Swift Programming Language

#323
post #37

I'm not even an iOS developer but this is by far the most exciting thing I heard in the keynote. As an amatuer/hobbyist programmer who's self-taught with Ruby, JavaScript, etc., the one thing that was keeping me from experimenting with iOS apps was Objective-C. I know I could tackle it, but it's been hard to take the plunge. I don't know much about Swift yet, but from what I've seen it looks very exciting. So if Appl…

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

It's not hate, but Objective-C can be intimidating.

Re: The Swift Programming Language

#325
post #304

Earlier quoted context omitted.

Practically speaking I'd prefer to work with a language and toolchain that doesn't require me to do that kind of stuff (write my own cross compiler from a derivative of the language that has all my own preferences for syntax). I'd constantly worry about maintaining that piece and having that cut into my quality & productivity. I think applied language theory as it pertains to productivity is fair game for a good disc…

"Clueless hipsters" will attract downvotes.

I just wouldn't bother to downvote for such a minor, subjective tone issue. Anyway, sorry, I'll end it here. Don't want to detract from the Swift discussion.

It makes me sad that companies are coming up with their own language stacks. Obviously Google vis a vis Oracle makes it a good move, if a company has the scale to accomplish and maintain it. Not to be a downer on what seems like a nice language, but other than that reason I see no need for Swift.

Re: The Swift Programming Language

#326

So it looks like the language isn't open source and won't target non-Apple runtimes? I'm not trying to troll, I just think that it's a pity that Apple tends to limit the ecosystem and applications of its otherwise-great languages. Building against LLVM ought to make it fairly trivial to make this cross-platform.

I can't even view the book about the language without having an Apple device or installing Apple software.

Re: The Swift Programming Language

#327
One thing I'm very interesting in knowing is how this affects the whole 'hybrid/web app' space.

Many web developers (like myself) have used Phonegap/Cordova in conjunction with tools like the Ionic Framework for our apps, primarily due to the nearly esoteric (for some of us) nature of Obj-C, but Swift almost looks like JS, which certainly has motivated me to learn it and use it in future apps.

I wonder if the aforementioned tools will lose market share because of that. Let's see.

Re: The Swift Programming Language

#328

Looks like PHP (or any c-based lang). Exciting!

I just returned to my IM client (did miss the swift live stream announcement) and read: "Oh, cool, new language. And it has a REPL" And all I thought was: "Please let it be a Lisp".

I guess you gotta go with what your customers (developers) would be most comfortable with

Re: The Swift Programming Language

#329
post #304

Earlier quoted context omitted.

Practically speaking I'd prefer to work with a language and toolchain that doesn't require me to do that kind of stuff (write my own cross compiler from a derivative of the language that has all my own preferences for syntax). I'd constantly worry about maintaining that piece and having that cut into my quality & productivity. I think applied language theory as it pertains to productivity is fair game for a good disc…

"Clueless hipsters" will attract downvotes.

I didn't use that term until after the downvotes.

Re: The Swift Programming Language

#330
post #52

"...we wondered what we could do without the baggage of C." Is that tongue in cheek? It's not even a particularly large, encumbered language, C.

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 totalitarian governments have already exploited this to monitor citizens and torture or kill them.

If that isn't enough, how about goto fail? All the IIS exploits in v4/5? Various Windows RPC overflows, WMF overflows, SQL Slammer, et al? How many billions in damages have been caused by stack smashing and buffer overflows? How many millions of hours of manpower wasted cleaning up after these errors? Toyota killed some people because their dumb code overwrote memory, blasting the OS task tables causing the watchdog task to stop getting CPU time, meaning nothing provided a stopgap against unintended acceleration. People are literally dying because we can't fucking let go of C.

C is like saying "forget seat belts, child seats, anti-lock breaks, and adaptive steering! How can I power-slide? I want full control; I need to pump the breaks. People should just drive better, then we'd have fewer accidents".

We've been trying to "drive better" for decades (Valgrind, lint, code reviews, static analysis tools, education, ASLR, NX protection, et al). We still regularly see massive security-smashing epic failures.

It hasn't worked. Furthermore the C standard library has been proven turing-complete for ROP gadgets in the presence of a buffer overflow. So no matter what you do, the presence of a single stack smash is enough to allow code execution, subject to payload size limits and execution time.

At some point we have to admit C is no longer acceptable. Not for libraries, not for drivers, not for operating systems. It has to go.

All the performance benefits ever derived from writing everything in C has been more than erased, by orders of magnitude, by the damage caused from even simple innocent mistakes.

Software allows us as programmers to greatly magnify our impact on the world; we like to think of that in positive ways. But the inverse is also true: thanks to the continued use of non-memory-safe languages we have the power to negatively affect the world on a massive scale.

It is unethical to continue writing code in non-memory-safe C or C-based languages, for any purpose. Period.

Post reply on HN