Re:Announcing Flutter beta 1: Build beautiful native apps
by kllrnohj on Tuesday February 27, 2018 @07:39PM
(#16479628)
But dart supports static typing, so that's just awkward. What does it even mean to take a num? What do you do with a generic num that may or may not be a double where isNaN makes sense? What value does this even have in a world of only int & double anyway? If a function returns 'num' does that mean isNaN is now something I need to worry about, or is it just badly over-generic code and it meant 'int'?
Stepping back, though, methods like isNaN only apply to a specialized subset of numbers, not the base on which all numbers build off of. So putting it on the base number class is the wrong layering. Same reason that bitwise operators are on int instead of num, because they don't apply to all numbers.
Stepping back, though, methods like isNaN only apply to a specialized subset of numbers, not the base on which all numbers build off of. So putting it on the base number class is the wrong layering. Same reason that bitwise operators are on int instead of num, because they don't apply to all numbers.