Skip to content

Add a lint to ban num #57793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
a14n opened this issue Sep 21, 2018 · 3 comments
Open

Add a lint to ban num #57793

a14n opened this issue Sep 21, 2018 · 3 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@a14n
Copy link
Contributor

a14n commented Sep 21, 2018

From #57779

maybe a better lint to address my concern is one to ban num entirely (whether given explicitly or by inference).

@a14n
Copy link
Contributor Author

a14n commented Sep 21, 2018

@Hixie what would you put in lint's description of this lint to explain why num should be ban ?

@Hixie
Copy link
Contributor

Hixie commented Sep 21, 2018

The primary idea is to avoid having code paths where the compiler needs to handle either int or double. cc @mraleph @a-siva @aam who might be able to confirm whether it's indeed more efficient to have code that unambiguously uses always int or always double or whether actually using num isn't such a big deal.

(The secondary reason here is to keep the code clear and catch likely bugs. It's often the case that if your code involves mixing int and double, you've probably stumbled into a less-than-fully-designed case that needs more thought.)

@mraleph
Copy link
Member

mraleph commented Sep 21, 2018

For computational kernels it is indeed better to have code that uses either int or double not num.

TFA sometimes might be able to infer what is stored in a particular num typed location - but not always.

@pq pq added the type-enhancement A request for a change that isn't a bug label Sep 30, 2018
@srawlins srawlins added the P3 A lower priority bug or feature request label Sep 22, 2022
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants