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

Add typeof #20027

Closed
DartBot opened this issue Jul 14, 2014 · 9 comments
Closed

Add typeof #20027

DartBot opened this issue Jul 14, 2014 · 9 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jul 14, 2014

This issue was originally filed by [email protected]


Is it possible to add typeof so that you can pass a generic type into a type argument?

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by @zoechi


Can you please explain a bit more what you would like to accomplish?

Something like: ?
new List<String>() is List<Object>

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by [email protected]


Yes so

public void loadSomething(Type type);

so you would set the type parameter like this:
loadSomething(typeof(List<string>));

as you cant do
loadSomething(List<string>);

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by @zoechi


and what should loadSomething(List<String>) actually do?
Create an instance of type List<String>?

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by [email protected]


i should just pass the type to that method like the following does.

loadSomething(List);

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by @zoechi


... and then? What should then happen?

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by @mezoni


Known workaround.

+++
void main() {
  var type = new TypeOf<List<int>>().type;
  print(type);
}

class TypeOf<T> {
  Type get type => T;
}
+++

@DartBot
Copy link
Author

DartBot commented Jul 14, 2014

This comment was originally written by [email protected]


Yes I am currently using this work around but can typeof() be implemented?

@sethladd
Copy link
Contributor

Removed Type-Defect label.
Added Area-Language, Type-Enhancement, Triaged labels.

@gbracha
Copy link
Contributor

gbracha commented Aug 26, 2014

I see this bug is as a duplicate of issue11923.


Added Duplicate label.
Marked as being merged into #11923.

@DartBot DartBot added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). Priority-Unassigned closed-duplicate Closed in favor of an existing report labels Aug 26, 2014
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants