Live data from Hacker News

SwiftUI Defaults Considered Harmful

tonsky.me

131–135 of 135 posts

Re: SwiftUI Defaults Considered Harmful

#131
post #130

Earlier quoted context omitted.

It does make sense. Because SwiftUI creates special constructs for regular language features (if, foreach) despite those features, you know, being available in the language.

It doesn’t make sense because SwiftUI is a declarative language. I understand the confusion, since it uses Swift’s DSL feature and is tightly integrated with Swift, but it is distinct and has it’s own design that isn’t directly compatible with Swift’s imperative control flow constructs. Now, you can argue that Apple should have created a new imperative Swift-integrated UI framework, and if they had, it would be a goo…

No. I, and the author, argue that nothing prevents Swift from having declarative foreach/if.

SwiftUI already introduces severely underdesigned awkward structures to replicate existing behavior, and it shouldn't.

SwiftUI's ForEach and If are ugly unnecessary hacks that replicate existing behavior and raise the question: why aren't other constructs there?

Re: SwiftUI Defaults Considered Harmful

#132
post #43
post #38

Earlier quoted context omitted.

After reading this I agree that SwiftUI terrible. I still don't get why it's considered "harmful" though.

This is basically a clickbait title at this point. After a now-famous CS letter by Dijkstra, "Go To Statement Considered Harmful"[1], the title format expanded dramatically. I'm personally a large fan of Meyer's '"Considered Harmful" Essays Considered Harmful'[2] as a explanation and satire of the genre. Wikipedia also has a decent summary[3]. 1: https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.p... 2: http…

Explaining "Considered Harmful" Essays Considered Harmful

Re: SwiftUI Defaults Considered Harmful

#133
post #88

> When fixing broken layout, it is always easier to add stuff that you forgot than removing stuff that your framework did for you and you that can’t see. This paragraph reminded me of this old Jargon File koan: --- In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6. “What are you doing?” , asked Minsky. “I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman…

I've never understood this one. Initialized randomly and then trained is accurate; Minsky is the one who comes off as ignorant, when the last line is supposed to indicate the opposite.

That's not ignorant on his part, it's just a silly analogy to get the point across; and I think you're missing the point by thinking of what happens after the network is trained; the point made is about the initial state of the network, not the outcome.

The neural network will have preconceptions on how to play no matter how, even if you wire them randomly; the difference of making them random is that you'll have no idea what those preconceptions are, not that they don't exist. The original story on which the koan is based might make it clearer.

[1] https://simple.wikipedia.org/wiki/Hacker_koan#Uncarved_block

If you still want this to be about the final state, the point would be that, if the training process works well, it shouldn't make any difference whether the net was wired randomly or orderly.

Re: SwiftUI Defaults Considered Harmful

#134
post #33

Earlier quoted context omitted.

Actually this a very common practice for Apple and well known among seasoned devs. Apple’s shiny new things don’t really belong in production apps until a few major versions in. In my decade of iOS development experience prevailing wisdom has been that nothing has ever worked until at least a few major versions in and don’t belong in production apps unless you really love rewriting your entire codebase. Good rule of…

Wouldn't Combine be the official competitor of RxSwift?

In the App Store that's called Sherlocking ;)

https://github.com/CombineCommunity/rxswift-to-combine-cheat...

Like I said, RxSwift is ready, SwiftUI/Combine isn't.

Post reply on HN