Live data from Hacker News

What’s new in Swift 6.2

hackingwithswift.com

11–20 of 258 posts

Re: What’s new in Swift 6.2

#11
post #3

I have not looked at Swift since I last wrote some around maybe v3. I hear that it's generally not a competitor to Rust, and is only really useful within the Apple ecosystem. Why is it not more useful as a C++ alternative, since I think that's kind of what the initial goal was? Is it just that non-Apple support is new-ish and not yet matured? Or a more fundamental issue?

Generally only useful within the Apple ecosystem is definitely inaccurate. An example: https://vapor.codes/ The problem is that people only think it’s generally useful in the Apple ecosystem.

what advantages does swift offer over go/rust/js/java for server side programming? I always presumed the advantages of swift were native code compilation + top tier integration w/the apple ecosystem.

Re: What’s new in Swift 6.2

#12

Earlier quoted context omitted.

Generally only useful within the Apple ecosystem is definitely inaccurate. An example: https://vapor.codes/ The problem is that people only think it’s generally useful in the Apple ecosystem.

what advantages does swift offer over go/rust/js/java for server side programming? I always presumed the advantages of swift were native code compilation + top tier integration w/the apple ecosystem.

It's a high level language that doesn't get in your way.

Re: What’s new in Swift 6.2

#13
post #5

> So, rather than writing > > @Test("Strip HTML tags from string") func stripHTMLTagsFromString() {...} > > we can instead write > > @Test func `Strip HTML tags from string`() {...} Maybe I'm just really new at programming, but this seems like an absolutely bad feature, and the example actually perfectly proves it: You really want to name a function "Hello World!" instead of helloWorld, just so your stack traces can…

I don't know about other languages but Ruby is similar in that you can name a function with any string (though you might not be able to call it in the standard way) and the Rails default test framework takes advantage of that.

Re: What’s new in Swift 6.2

#14
post #7
post #5

> So, rather than writing > > @Test("Strip HTML tags from string") func stripHTMLTagsFromString() {...} > > we can instead write > > @Test func `Strip HTML tags from string`() {...} Maybe I'm just really new at programming, but this seems like an absolutely bad feature, and the example actually perfectly proves it: You really want to name a function "Hello World!" instead of helloWorld, just so your stack traces can…

It just seems to me that this is the exactly wrong way to solve a programming problem. If the problem boils down to "I want some variables (almost always test function names) to be more human readable", the solution should never be "hey let's add this feature to the core language and make identifiers use any ASCII string! I dunno, maybe I'm wrong here and being overly critical. But to me it just screams "Swift has lo…

The HTTPStatus enum example is a good one, but the backtick syntax is _rough_. I would only ever use the Type.case form in practice. The test stuff is basically a way to create BDD-style test names, which is kind of just a preference thing. I can’t envision myself using it for anything other than weird case names (I already use case `default` quite a lot because it’s such a useful word), but maybe some interesting DSLs can come out of it? I would not have prioritized that change personally.

Re: What’s new in Swift 6.2

#15
post #5

> So, rather than writing > > @Test("Strip HTML tags from string") func stripHTMLTagsFromString() {...} > > we can instead write > > @Test func `Strip HTML tags from string`() {...} Maybe I'm just really new at programming, but this seems like an absolutely bad feature, and the example actually perfectly proves it: You really want to name a function "Hello World!" instead of helloWorld, just so your stack traces can…

Tests are never called explicitly by programmers, or at least they never should be. You could argue that they don’t really need to be functions at all, just pieces of code that represent tests.

Re: What’s new in Swift 6.2

#16
post #5

> So, rather than writing > > @Test("Strip HTML tags from string") func stripHTMLTagsFromString() {...} > > we can instead write > > @Test func `Strip HTML tags from string`() {...} Maybe I'm just really new at programming, but this seems like an absolutely bad feature, and the example actually perfectly proves it: You really want to name a function "Hello World!" instead of helloWorld, just so your stack traces can…

Tests are never called explicitly by programmers, or at least they never should be. You could argue that they don’t really need to be functions at all, just pieces of code that represent tests.

That's how Zig tests work. This is basically a function with a different syntax.

test "strip html tags from string" {

  ...

}

Re: What’s new in Swift 6.2

#17

Earlier quoted context omitted.

Generally only useful within the Apple ecosystem is definitely inaccurate. An example: https://vapor.codes/ The problem is that people only think it’s generally useful in the Apple ecosystem.

what advantages does swift offer over go/rust/js/java for server side programming? I always presumed the advantages of swift were native code compilation + top tier integration w/the apple ecosystem.

In my little usage of it (and go and rust), Swift feels like a nice middleground between go and rust. Or, a better (safer) go.

I think Swift is vastly underestimated due to it's relation to Apple.

Re: What’s new in Swift 6.2

#18

Earlier quoted context omitted.

Generally only useful within the Apple ecosystem is definitely inaccurate. An example: https://vapor.codes/ The problem is that people only think it’s generally useful in the Apple ecosystem.

what advantages does swift offer over go/rust/js/java for server side programming? I always presumed the advantages of swift were native code compilation + top tier integration w/the apple ecosystem.

I have a few personal and professional Swift on server projects, in the wild and in the works. Code reuse is a big win – we can ~easily expose functionality of our client apps to other systems. Familiarity is another – there's an ocean of iOS (and, to a lesser extent, macOS) developers out there who are familiar with Swift. With a little bit of coaching, they can pretty quickly get up to speed with how services work.

It reminds me a lot of what it was like to ship Node.js software 15 years ago – the ecosystem is still young, but there are enough resources out there to solve 95% of the problems you'll face.

Re: What’s new in Swift 6.2

#20

Earlier quoted context omitted.

Generally only useful within the Apple ecosystem is definitely inaccurate. An example: https://vapor.codes/ The problem is that people only think it’s generally useful in the Apple ecosystem.

what advantages does swift offer over go/rust/js/java for server side programming? I always presumed the advantages of swift were native code compilation + top tier integration w/the apple ecosystem.

The advantage is obvious if you already use Swift.
Post reply on HN