Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is a little out of date but a few years back I wrote up a few key differences: https://gist.github.com/GeorgeLyon/c7b07923f7a800674bc9745ae...


Thanks for this list!

> No macros / build-time code generation

While I do appreciate macros, and use them sparingly I find the best case for them is doing things like generating to/from <protocol> (e.g. JSON) implementations.

In Haskell, there's a fully baked system for derivation where you can set up implementations that walk the type trees, but most other languages don't have that -- I find macros to be a great slightly lower complexity way to do this kind of thing.

What is Swift's answer in production? Does everyone just write extensions for their types? Rust's serde is a joy to use and 99% of the time "just works", despite the macro magic.

> Type system function resolution

I'm not sure this is a real problem for me or most people, but taken with the point about polymorphism (I guess this point is basically about late binding), I see the benefit here.

> Protocols vs Traits as implemented

Generic methods being allowed in Swift is quite nice.

> Sugar

Great points in there -- some of them are style/preference but I can definitely see benefits to a bunch of them.

The string interpolation point you might want to update (Rust does that now!)

Named arguments are also quite amazing.

Again, fantastic list -- saved! I've been meaning to give Swift a proper try lately and this is a great reference.


For the record "No macros", is one of the things that is out-of-date. There is some discussion about it in the comments... maybe I'll be forced to actually update it :)


After having written a few of them at this point at $DAYJOB and on my own... They're actually not so bad at all -- it's quite nice the world that they open up.

I'd venture to say most people are mostly annoyed at the overuse of macros (where a simple function would do).

Rust's attribute system is something it REALLY got right -- stuff like #[cfg(test)] and the conditional compilation stuff is really really impressive. Not sure what cross platform dev looks like in Swift but the bar is quite high in Rust land.




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

Search: