Live data from Hacker News

What’s new in Swift 6.2

hackingwithswift.com

201–210 of 258 posts

Re: What’s new in Swift 6.2

#202
post #29

Free-form identifiers are neat for test-case naming, but not for `HTTPStatus.`404``. I think having `HTTPStatus.Error404` was a bad idea to begin with. Just use semantic names like `HTTPStatus.NotFound` and you wouldn't have a problem in the first place. Now, a single character typo can easily make a 404, 403 and create a bug. It's less of a problem with semantic names. If you want constrained numeric types in Swift,…

> Just use semantic names like `HTTPStatus.NotFound` and you wouldn't have a problem in the first place.

Have to disagree there: when I tried re-implementing a basic websocket server in multiple languages (https://news.ycombinator.com/item?id=43800784), I found it so frustrating when they'd insist on hiding the raw close-codes behind pretty names, because it meant having to stop what I was doing to jump into the documentation to figure out what pretty name they gave a particular close code.

All I wanted was to return 1003 (https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1) if the websocket sent a string message, but:

- Dart calls this "unsupportedData" (https://api.dart.dev/stable/latest/dart-io/WebSocketStatus/u...)

- Java-Websocket calls this "REFUSE" (https://javadoc.io/doc/org.java-websocket/Java-WebSocket/lat...)

- Ktor calls this "CANNOT_ACCEPT" (https://api.ktor.io/ktor-shared/ktor-websockets/io.ktor.webs...)

And some others:

- .NET calls this "InvalidMessageType" (https://learn.microsoft.com/en-us/dotnet/api/system.net.webs...)

- libwebsockets calls this "LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE" (https://libwebsockets.org/lws-api-doc-main/html/group__wsclo...)

Just... why? Just call the thing 1003 and link to the spec.

Re: What’s new in Swift 6.2

#203
post #127

Earlier quoted context omitted.

Escaping symbols with backticks to circumvent illegal characters and reserved keywords is a feature coming straight from Scala actually.

Cool. I was smitten with Scala for a while but it was getting too complex after a while. Like Swift and C++.

I think it's genuinely simpler than Swift or Kotlin that have seen an explosion of grammar, keywords and features.

The modern Scala ecosystem has mostly converged towards one style even though it's fully compatible with the more questionable Java/JVM constructs like runtime reflection, annotation processing and so on. Sure you have to understand a few FP concepts that might be alien at first, but there's a fairly straight and clear path unlike hybrid languages that evolved in too many directions at once.

Meta-programming features have also been completely overhauled with Scala 3 and are more approachable, especially if you're just an end user that needs a library doing generic derivation for instance.

Odersky is also on a crusade against monadic effect systems and we might get something like algebraic effects, direct-style.

Re: What’s new in Swift 6.2

#204
post #129

Earlier quoted context omitted.

Right? I don't get this persons sentiment and I don't understand how it relates to the post in particular.

You still have to choose, and remember all the variants. Coming back to a Swift codebase after a few months in different languages is surreal, I can't remember what half of it means.

Alright, I think I know what you mean - swift does have a peculiar way of completing tasks but I would also say C++ and ObjC do too but I also don't think there are too many ways.

I find you can do apply java and javascript type thinking to swift but they're less preferred.

Re: What’s new in Swift 6.2

#205

Mostly nonsense updates. Swift was my favorite programming language after C++/Java since 2014. I've been faced major updates few times happily. It was one of the most easiest language. But now, I tried to update a project from Swift 5.x to 6.x which has 150+ source files itself and no external libraries which is written by my own use and it has almost all swift 5.x features. They made up Swift as super hard. I decide…

My guess is you've encountered issues with actor isolation made suddenly explicit in your language upgrade. This is exactly what's addressed in Swift 6.2, so it won't be nonsensical in that case. Speaking from my personal experience of trying to upgrade and stopping. The moment this language version is released I will move to Swift 6. In our project case it will happen. with no source code changes.

Yes, https://stackoverflow.com/questions/79589648/actor-isolated-...

Re: What’s new in Swift 6.2

#206
post #98

Mostly nonsense updates. Swift was my favorite programming language after C++/Java since 2014. I've been faced major updates few times happily. It was one of the most easiest language. But now, I tried to update a project from Swift 5.x to 6.x which has 150+ source files itself and no external libraries which is written by my own use and it has almost all swift 5.x features. They made up Swift as super hard. I decide…

I don't use the new concurrency features, as they are one of the main culprits of this mess. (so stick with 5.x) SwiftUI is a wreck, that is still not good for advanced UI and you still have to use UIKit for some parts, and Taking Objective-C, with DispatchQueue, and some modernization of it, and some new data structures, which it need, was all it was needed to make a good new langue. It could have been Apple's rival…

> but instead it ended up being hydra/monster with too many pardagimns, and none of them are good.

So true.

Re: What’s new in Swift 6.2

#207
post #180

It sure feels like Swift governance is broken. They're just shoveling stuff in to the language. Individually, most items aren't so bad, but collectively they've got a mess and it's getting bigger fast. None of the decision-makers seem to have the sense or incentive to say "no" to anything. It's sad, because the language had such promise and there are some really nice things in there. Well, at least it's relatively ea…

> None of the decision-makers seem to have the sense or incentive to say "no" to anything.

How could you know that? Not all the 'no's show up as a proposal. The proposal template also has an "Impact on ABI" section which you can use to guide your "can I ignore it"-sense.

> It sure feels like Swift governance is broken.

What is the actual problem though? Not enough features that you would use? But I don't see how this is a governance problem

Java governance: slow at times but mostly sane. C++ governance: I won't even open this can of worms. Swift governance according to you: too many features I will ignore.

Re: What’s new in Swift 6.2

#208
post #2

Do you try to put everything on the main actor to dramatically reduce your debugging time?

Apple effectively solves the problem which doesn't exists.

Before Swift 6, I've worked lot of unique projects both macOS and iOS and never spend time on debugging. I don't know what debugging time exactly?

Re: What’s new in Swift 6.2

#209
post #130
post #28

Earlier quoted context omitted.

Considering Swift was primarily written in C++, perhaps Swift was always destined to follow the same path?

Makes some sense, since its developers probably thought C++ was a pretty good idea, it just needed some more features. Same mindset that killed Rust for me. I gave up on C++ for good reasons, after spending roughly 20 years trying to make sense of it.

Why not just code in a small, sane subset of C++ that you understand perfectly? That's what I do with TypeScript and it works fine.

Re: What’s new in Swift 6.2

#210
post #98

Mostly nonsense updates. Swift was my favorite programming language after C++/Java since 2014. I've been faced major updates few times happily. It was one of the most easiest language. But now, I tried to update a project from Swift 5.x to 6.x which has 150+ source files itself and no external libraries which is written by my own use and it has almost all swift 5.x features. They made up Swift as super hard. I decide…

I don't use the new concurrency features, as they are one of the main culprits of this mess. (so stick with 5.x) SwiftUI is a wreck, that is still not good for advanced UI and you still have to use UIKit for some parts, and Taking Objective-C, with DispatchQueue, and some modernization of it, and some new data structures, which it need, was all it was needed to make a good new langue. It could have been Apple's rival…

> SwiftUI is a wreck, that is still not good for advanced UI and you still have to use UIKit for some parts, and

Skill issue. *ViewRepresentable exists.

Post reply on HN