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

> If the creator of Ruby had broadened their horizon, and instead realised that outside the world of experienced software developers, the expression "1/2" means something totally different, maybe they could have chosen a different behaviour.

IMO, that would be a tragedy.

In every language that does it implicit type coercion is the cause of a litany of bugs.

It's the cause of many problems in php. It's why people are told not to use == in javascript.

Maybe it is more difficult for beginners. But people are only beginners for a couple of weeks. It makes no sense to design the language to make those couple of weeks a little better and the rest of their programming lives a lot worse.




I agree, but I didn't suggest implicit type coercion. The bugs in Javascript are because of type coercion, but that has nothing to do with the fact that numbers in typescript are all floats. I don't think there are many bugs in Javascript that are due to numbers being floats, though I bet there's some companies who decided to build their backend in Javascript that might eventually run into problems.

There's ways to design a number class that doesn't suffer from any of these problems (obviously it would have to sacrifice performance to some degree).




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: