Comment

Comment by RetpolineDrama

Super cool! I absolutely adore swift, it has so many simple features I love that I am sometimes surprised to find are missing in other languages. (ex off the top of my head: switching on enum's with associated values is super powerful in Swift and I was surprised Dart was completely missing that when I tried flutter a while back?)

Ex:

enum MyEnum<T> {

   case one

   case two(twosChild: Child)

   case three(threesGenericChild: T)

   case four(foursCallbackChild: () -> Void)
}

You can then pass this enum around and switch on it, with compiler-guaranteed completeness everywhere in your codebase. It seems so freaking simple, but it's incredibly useful.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton