-
Notifications
You must be signed in to change notification settings - Fork 224
Closed
Labels
requestRequests to resolve a particular developer problemRequests to resolve a particular developer problem
Description
In Dart, unlike many other languages, integers and doubles are objects, not "primitive values". There are no special rules converting between the types on assignment (assignment generally preserves the identity of objects).
This can be annoying when you want to write something simple, like:
double x = 10;
foo(double x) => ...;
foo(42);
Here the integer number isn't allowed where a double is expected, so the program fails to compile. You have to write it as 10.0
and 42.0
to get the program compiling. This is annoying, and it feels like needless overhead when the meaning is clear.
I would be nice if you didn't have to write the extra .0
, the compiler should be able to figure that out.
Proposed solutions: #4
Metadata
Metadata
Assignees
Labels
requestRequests to resolve a particular developer problemRequests to resolve a particular developer problem