Programmer Daniel Hooper writes about C, Swift, compilers, and developer tools, with graphics and build visualization projects.
HN commenters cite his posts on slow Swift type inference, segmented arrays, and type-safe generic data structures in C.
> Both Kotlin and Swift are compiled.
I only said that because you said performant code "does not matter for a mobile app". I think writing apps in native frameworks is awesome! I'm all for it. BTW, I've heard some reports that SwiftUI/Swift are slow[1][2][3]. Again, I haven't explored SwiftUI and Kotlin, but I'd like some day. What do you love about them so much?
> All that for being at best similar to the native tools, but probably never exactly the same. And it cannot be better, because the native ones are the ones defining how it should be.
I agree, the best apps would almost always be those written in the framework the OS provides - kinda make sense - cross platform GUIs will always fall under the lowest common denominator issue - I've written about it in my blog post[4]. You also forget tho, that Linux does exist with a growing popularity - I think it's important to target it as well (I've started GUI development because I was on Linux and most apps had horrible UI/UX).
> but starting a new mobile UI with QML these days is just madness IMHO :-)
Follow my mad adventure (:
[1] https://notes.alinpanaitiu.com/SwiftUI%20is%20convenient,%20but%20slow
[2] https://x.com/daniel_nguyenx/status/1734495508746702936
[3] https://danielchasehooper.com/posts/why-swift-is-slow/
[4] https://rubymamistvalove.com/block-editor#9-aesthetics
Well I Googled myself since I was curious
This comment says Rust's type inference is not Hindley-Milner, but rather it's "influenced by" bidirectional type checking: https://lobste.rs/s/hbzctm/type_inference_rust_c
(but I think that is about type inference; I think there are parts of the Rust's type checking algorithm that could be described with different terms)
---
This post quotes Chris Lattner on Swift, saying
https://danielchasehooper.com/posts/why-swift-is-slow/
My experience with Swift is we tried to make a really fancy bi-directional Hindley-Milner type checker
So I guess this hints at what I suspected -- that people mean different things when they say "bidirectional"
---
But also, it's probably reasonable to put Go and Zig (?) in one category, and Swift and Rust in another
I only want one feature from Swift: faster type-checking. If you write a few lines of math, or a moderately complex SwiftUI expression, suddenly the typechecker starts timing out. Swift is the only language I've ever used with this problem.
https://hachyderm.io/@evanw/109859384302551859
https://www.cocoawithlove.com/blog/2016/07/12/type-checker-issues.html
https://danielchasehooper.com/posts/why-swift-is-slow/
This isn't mentioned at all in the announcement so I'm kind of disappointed.
They link to an old article [1] that was featured in HN [2] somewhat recently, in which there's a workaround for older standards with regards to typeof.
[1]: https://danielchasehooper.com/posts/typechecked-generic-c-data-structures/#:~:text=old%20compilers
[2]: https://news.ycombinator.com/item?id=44425461
Around midnight LA time, except the code may have a bug (?) with respect to DST changes (uses explicit UTC-8, which won't be correct the whole year). See source code at https://danielchasehooper.com/projects/cracked-sudoku/script.js
> using arenas for arrays that grow wastes memory a lot since it keeps every previous version around
Not if you use segmented arrays
https://danielchasehooper.com/posts/segment_array/