Discussion:
[dart-misc] Conversions in Dart
Raquel Moreno
2016-09-13 03:10:40 UTC
Permalink
What's up guys? I need your help.

I know that Dart is dynamically typed and all that stuff, but I'm
wondering about how Dart works with narrowing conversion and widening
conversion. Or it simply doesn't work with it? I read a lot of links on the
internet and I dont conclude anything. Someone could light up my mind about
it?

Thanks
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Erik Ernst' via Dart Misc
2016-09-13 07:43:38 UTC
Permalink
Post by Raquel Moreno
What's up guys? I need your help.
I know that Dart is dynamically typed and all that stuff, but I'm
wondering about how Dart works with narrowing conversion and widening
conversion. Or it simply doesn't work with it? I read a lot of links on the
internet and I dont conclude anything. Someone could light up my mind about
it?
The basic coercion mechanism is available as methods on the built-in
classes. For instance, `print(3.14.toInt())` prints "3". Check out pages
like https://api.dartlang.org/stable/dart-core/double-class.html for
related methods like `ceil`, `floor`, and `truncate`.

Thanks
Post by Raquel Moreno
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
Erik Ernst - Google Danmark ApS
Skt Petri Passage 5, 2 sal, 1165 KÞbenhavn K, Denmark
CVR no. 28866984
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Lasse R.H. Nielsen' via Dart Misc
2016-09-13 07:43:47 UTC
Permalink
Post by Raquel Moreno
What's up guys? I need your help.
I know that Dart is dynamically typed and all that stuff, but I'm
wondering about how Dart works with narrowing conversion and widening
conversion.
Dart has no automatic conversions, neither narrowing, widening, or
otherwise.
Post by Raquel Moreno
Or it simply doesn't work with it? I read a lot of links on the internet
and I dont conclude anything. Someone could light up my mind about it?
Since Dart only has one integer type, a "bigint" that supports arbitrary
magnitude numbers, there is no need for narrowing or widening, nor is there
any type to narrow or widen to.

In Dart 2 that may change if it introduces fixed-sized integers.

/L
--
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...