Skip to content
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

remove uses of runtimeType #87

Closed
wants to merge 1 commit into from
Closed

Conversation

devoncarew
Copy link
Member

  • remove uses of runtimeType from the codebase (these were all in toString methods; the uses there were changed to just report the main parent type)
  • fix Consider not using runtimeType #85

@kevmoo
Copy link
Member

kevmoo commented Sep 3, 2022

Would this mess up the specificity of subclasses?

@devoncarew
Copy link
Member Author

devoncarew commented Sep 3, 2022

Would this mess up the specificity of subclasses?

Yes, it would change that. Instead of specifying the exact type of the class (FileSpan, SourceSpanWithContext, ...) it would just report the general type (SourceSpan or SourceLocation). We could customize the various subclass toString() methods to report the more specific subclass type, or introducing some String get typeName abstraction that the general toString() method could call. I'm not sure how much effort or architecture is warranted here however, given that the toString() methods are just used for improved diagnostics when debugging.

It's perhaps worth customizing some of the main subclasses (FileSpan, ...)?

@kevmoo
Copy link
Member

kevmoo commented Sep 7, 2022

I don't think there is a lot of value in ditching runtimeType. This is not likely used in JS code, etc.

What's the worry?

@devoncarew
Copy link
Member Author

@jonasfj - from #85 - what was your use case (I imagine you were seeing the dart2js warning when building a web app)?

@devoncarew
Copy link
Member Author

(dropping this PR)

@devoncarew devoncarew closed this Nov 3, 2022
@jonasfj
Copy link
Member

jonasfj commented Nov 3, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider not using runtimeType
3 participants