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

What I really miss in Swift are user definable attributes. Also I would like to have the Objective-C attribute that requires you to always call super. I don't think that Swift even honors that attribute if it is defined in Objective-C.

I consider it weird that the "where" keyword can't be applied in more places, only in case and for ... in I believe it works. Seems like some weird remnant of "what cool feature of C# could we borrow?" that never really got a full rollout.

Also I would like to have a "not" keyword instead of using the easily overlooked !. Such a nice feature of F# (and Visual Basic?).

Good to see count(where:) coming to the language, I often missed it. And probably is faster than filter since it doesn't create an array of results first.

Apart from that Swift 5 doesn't seem to be super different from 4. But that's what I expected already.




Where do you miss user-definable attributes from? I'm not aware of any analogous ObjC feature.

The `where` keyword is also used when defining generic functions/types. As the expression level, it used to be used in `if` too, but that syntax was changed such that it no longer uses `where` (but still retains the same power). Where else were you expecting it to be used?

You can do a non-allocating `count(where:)` today with `lazy.filter(where: …).count`.


C# has them. Java too?




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

Search: