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

This is called coercion — implicit conversion between types.

Numeric types coercion is very basic convenience that is present in many statically typed programming languages. Older languages like C used to allow unsafe conversions, but modern ones like C# or Java are doing it right: for example, adding int and float is allowed, but assigning float to int is not. There is no reason Swift shouldn't have the same.

I suspect is has been given up (temporarily or not) because of type inference. Swift's already giving "expression is too complex" errors in some situations, numeric coercions would surely make it worse.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: