--
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
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
For bool, its a bit, if its not null, then it's natural for 0 stand for false, 1 stand for true, if you want the reverse result, use ! Operator.
For the possible of being null, cause toInt is a member function, if it's null, call to this will cause exception, so that s not a problem. I think, sometimes, following the obvious way is the best way, no need to create inconvenience intentionly
2014年5月8日 上午2:11于 "Matthew Butler" <butler....@gmail.com>写道:
>
> I believe long ago there was discussion about this and in the opposite direction early on (pre-M1) of Dart. However there are a few problems with casting a bool to an int. For instance why arbitrarily '1' for true? Why not 500? Or -132001238 ?
>
its not based on other language, but the nature of bool itself, bool stand for two state (true , false). can be naturally represent as 1/0. Why not true=0, false=1, its basically because true=1 is more convention, reference to mathematical logic.