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

The Swift patterns Emerging definitely favor explicit conversions over implicit. One of the QA questions begins eluding to some issues with this pattern with under and overflows, but the author also doesn't mention safety around Nan's or Infinity. Last thing I want as a consumer of an API is surprises. There are good reasons why these value types are non interchangeable without being explicit.


Good point bringing up over/underflow, I didn't think much about Nan or infinity, but I did consider potential over/underflows. I originally built an overflow/underflow checker(on the github project), but then re-evaluated it and figured it wasn't really necessary since the default action for number types that overflow/underflow in swift is to throw an error runtime. The person asking the question mentioned another series of operators that exist &+, &-, &*,etc that allow for overflow/underflow to occur on number types in swift.. without the error throwing, which is not the default.




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

Search: