Hacker News new | past | comments | ask | show | jobs | submit login

> I would be curious to know what he thought of Swift (having worked on the compiler). The language seems to be the opposite of Go in including every language feature under the sun.

Are you asking from a language design perspective? Or from an implementation perspective?

From a language design perspective, yes, Swift has a lot of features. Most of these features exist for good reasons.

- First-class Objective-C interop: Needed for initial adoption and migration, since Apple's SDKs were all Objective-C. (See also: Kotlin and Java etc.)

- Protocols with associated types: Writing generic code with constraints makes surfacing type errors easier compared to templates. Associated types enable many natural patterns of programming.

- Library evolution: Being able to evolve APIs without breaking ABI is super important for a platform.

- Support for DSLs: Swift is used heavily for UI programming, and there is a convergence across languages in terms of having DSLs for making building UIs easier.

- Use of weak pointers (vs having a tracing GC for cycles): Better for Objective-C compatibility.

- Async/await + actors: Trying to balance usage of Dispatch (which is the platform API) with newer programming patterns, while still being able to compile in a way with low resource usage.

- Upcoming C++ interop: Many big iOS applications use large amounts of C++, so better interop would make Swift usage easier for them.

Does that mean I think every feature of Swift is perfect? No. For one thing, I think method overloading is way too flexible, which is what causes exponential time for type inference in a bunch of cases.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: