Live data from Hacker News

Apple announces full Swift rewrite of the Foundation framework (2022)

infoq.com

191–200 of 402 posts

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#191

Earlier quoted context omitted.

Swift certainly can be a scripting language. #!/usr/bin/env swift print("hello, world!")

Of course, but so can C++ and Java: https://stackoverflow.com/a/29709521

Implicit main in Swift means you don't need "public static void main..." or other boilerplate.

No reason why Java and C++ couldn't do something similar though.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#193

Earlier quoted context omitted.

Apple. They now gatekeep access rather than it being open to anyone with the money to hack the platform.

So, we should feel safe knowing that Apple is protecting us from the wrong governments and working with the right ones? Considering how attached they are to the Chinese market, one would be forgiven for assuming Apple too is motivated by money over ethical responsibility.

Better just apple than apple + hackers. Not ideal but incremental progress is still progress.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#194
post #70

Earlier quoted context omitted.

If you don't care about performance and "zero cost abstractions" and are more interested in Rust for its memory safety, then most of your Rust programs end up with a lot of syntactic and library bloat to add those "costly" (but convenient) abstractions back in, like explicitly cloning or wrapping types in Rc and Arc or just always taking ownership of borrowed data by constructing owned types with it. And then there a…

> Alternatively, it would be neat to see some effort put behind a "convenient rust" type of compile mode for modules where you could compile with things like implied clones, unified owned vs reference types, auto-arc/box, etc. If you can come up with a precise transform from "convenient/sloppy rust" to the underlying language, it can already be implemented via proc macros and the #[attributes] syntax. This is how asy…

Maybe bloat wasn't the right term (was thinking that it bloats the code, not the resulting program), but when you're in a scenario where you're doing one thing more often than the default, it feels like boilerplate to have to continually say `String::from("some string ref")` (as an example) just to take ownership when that's what you want every single time. Or, at least something like an "owning assignment" or "owning deref" operator that automatically adds the `to_owned()` call would help reduce boilerplate.

Maybe it was a mistake to conflate lifetimes and generics. It wouldn't be so bad to deal with references in Rust if you didn't have to include lifetime parameters when building APIs. It seems silly that (in my experience) people gravitate toward structs with owned fields just to avoid specifying the lifetime of a borrowed field.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#195
post #89

So apple seems to be dropping c like languages, Microsoft says new stuff should not be written in c like languages anymore, and google has steadily worked towards using rust and go in place of c and c++ where it makes sense to do so it seems. There seems to be a trend here.

Forgive me, is swift not in the c family? I could have sworn that it was, but I'm not overly familiar with it.

As I would use the terminology, the C family of languages generally corresponds to languages that follow C's general syntactic rules, such as how you represent operators (particularly = is assignment and == is equality), curly braces for blocks, and to lesser degrees, making distinction between statement/expression, or having types precede variable names.

"C-like", by contrast, is a language whose semantics follow closely to C, and in particular, the C-with-extensions languages like C++ or Objective-C are usually going to fall into this category.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#196

Similar post by Michael Tsai with some quick summary points of the impact of this: https://mjtsai.com/blog/2022/12/12/the-swifty-future-of-foun...

Not sure why but most people don't seem to have noticed that people outside Apple will now be able to contribute to Foundation and these contributions will ship across all platforms.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#197

Is there anything genuinely innovative about Swift or is it just another "cross-platform scripting language" that I'll only see on 1 platform? The only reason I learned Powershell is because I have to admin for Windows. At least Powershell is interesting for its pipeline and object handling. I get not one spark of joy from Swift, and the comments I see are "at least we're not writing C anymore". Stockholm syndrome. S…

swift isnt new, but yeah i agree its not as exciting to think about as rust or Go. I think i prefer it over some of the oddities from TS, but certainly over js.

Swift can do everything Go does but better now that it has async/await because it has real types and a real unsafe API. Calling C from Go is horrendous.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#198
Good for Apple. In my opinion they are laying the groundwork for reducing technical debt.

Objective-C had a good run. I haven’t used Objective-C in over 10 years but I have used Swift about 10% of the time in the last four years. Swift is a nicely designed language and I could see it supporting Apple’s business for many years.

Will Swift ever be a primary language on Linux? I would say yes, except now that Rust is used the advantages of also mixing in Swift are diminished.

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#199
post #149
post #70

Earlier quoted context omitted.

If you don't care about performance and "zero cost abstractions" and are more interested in Rust for its memory safety, then most of your Rust programs end up with a lot of syntactic and library bloat to add those "costly" (but convenient) abstractions back in, like explicitly cloning or wrapping types in Rc and Arc or just always taking ownership of borrowed data by constructing owned types with it. And then there a…

>If you don't care about performance and "zero cost abstractions" and are more interested in Rust for its memory safety... Just about GC language has similar tradeoffs. The question here would be why Swift over Go/C#/Java/Python/Typescript?

Well that's easy. Swift is:

1. Much more expressive and featureful than Go

2. More concise and modern than C# (debatable maybe?)

3. Less JVM than Kotlin (the apples-to-apples; Java is a much worse language)

4. Way, way faster and more typesafe than Python

5. Better support for parallel execution (and probably fine-tuning other performance knobs) than TypeScript

Re: Apple announces full Swift rewrite of the Foundation framework (2022)

#200
post #193

Earlier quoted context omitted.

So, we should feel safe knowing that Apple is protecting us from the wrong governments and working with the right ones? Considering how attached they are to the Chinese market, one would be forgiven for assuming Apple too is motivated by money over ethical responsibility.

Better just apple than apple + hackers. Not ideal but incremental progress is still progress.

It will never be ideal while Apple's ethics are so soft. Let's help them do the right thing.
Post reply on HN