'Brian Wilkerson' via Dart Misc
2015-09-03 21:58:03 UTC
There are two ways that I can think of for handling false positives. One is
to carefully define the hint such that there won't be any false positives.
The other is to specify a way to tell the analyzer that you know what
you're doing. The first is almost always better.
For the case of dropped futures, I can't think of a way to avoid false
positives. As far as I know the cases where it's ok to not wait for the
future look (statically) just like the case where it isn't. (If that's not
true, I'd love to hear what the rules should be for deciding when to
produce a hint.) That leaves me thinking we need some way to tell the
analyzer when it's ok.
We can do that by extending the language (something like a "don't wait for"
keyword where the "await" keyword would have been) or by using annotations.
I really don't want a separate keyword, and I doubt anyone else does either
:-).
The problem with annotations, though, is their granularity. It seems
plausible that users could have a single method that invokes multiple
future-returning functions/methods and that only one of those invocations
should be allowed to be dropped. Unfortunately, as things stand today, you
can't annotate expressions. You can't even annotate statements, though that
would probably be sufficient because I expect that the invocation would
almost always be the top-level expression in an expression statement.
So, is there a better solution that I'm not thinking of?
Brian
to carefully define the hint such that there won't be any false positives.
The other is to specify a way to tell the analyzer that you know what
you're doing. The first is almost always better.
For the case of dropped futures, I can't think of a way to avoid false
positives. As far as I know the cases where it's ok to not wait for the
future look (statically) just like the case where it isn't. (If that's not
true, I'd love to hear what the rules should be for deciding when to
produce a hint.) That leaves me thinking we need some way to tell the
analyzer when it's ok.
We can do that by extending the language (something like a "don't wait for"
keyword where the "await" keyword would have been) or by using annotations.
I really don't want a separate keyword, and I doubt anyone else does either
:-).
The problem with annotations, though, is their granularity. It seems
plausible that users could have a single method that invokes multiple
future-returning functions/methods and that only one of those invocations
should be allowed to be dropped. Unfortunately, as things stand today, you
can't annotate expressions. You can't even annotate statements, though that
would probably be sufficient because I expect that the invocation would
almost always be the top-level expression in an expression statement.
So, is there a better solution that I'm not thinking of?
Brian
--
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+***@dartlang.org.
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+***@dartlang.org.