Skip to content

Allow class objects in constructors #8486

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

Closed
DartBot opened this issue Feb 11, 2013 · 9 comments
Closed

Allow class objects in constructors #8486

DartBot opened this issue Feb 11, 2013 · 9 comments
Assignees
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 P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented Feb 11, 2013

This issue was originally filed by [email protected]


please add the class name reference by argument, like this example:

class Foo {
  
}

main() {
  myFunction(Foo);
}

myFunction(class) {
  class f = new class(); //class = Foo
}

@kwalrath
Copy link
Contributor

This seems like a language tour thing.


Set owner to @kwalrath.
Removed Site-Tutorial label.

@DartBot
Copy link
Author

DartBot commented Feb 23, 2013

This comment was originally written by [email protected]


i'm freaking up to do this function in my game framework:

instance_create(x, y, obj) {
  var inst = new obj();
  inst.x = x;
  inst.y = y;
  return inst;
}

there is a chance to do this in someway ?

@DartBot
Copy link
Author

DartBot commented Feb 23, 2013

This comment was originally written by [email protected]


i can't do: instance_create(x, y, new obj())
because also I must reference the "class name" in another function

etc... collideMethodWith(class) etc...

@kwalrath
Copy link
Contributor

Is this a doc request or a language request?

@DartBot
Copy link
Author

DartBot commented Feb 25, 2013

This comment was originally written by [email protected]


language request

@kwalrath
Copy link
Contributor

Reassigning to Gilad.


Set owner to @gbracha.
Removed Area-Site label.
Added Area-Language label.

@gbracha
Copy link
Contributor

gbracha commented Feb 25, 2013

Allowing this sort of thing is very attractive. We have to be sure of the implications, especially for JS compilation. So, yes, we are considering it, but it may be a while.
Changing the bug description to be clearer.

In the meantime, reflection can help (at least on the VM).


Added Accepted label.
Changed the title to: "Allow class objects in constructors".

@DartBot
Copy link
Author

DartBot commented Mar 21, 2013

This comment was originally written by [email protected]


Added Priority-Medium label.

@DartBot DartBot added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). Type-Defect labels Mar 21, 2013
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed accepted labels Feb 29, 2016
@munificent
Copy link
Member

Duplicate of #10667.

@munificent munificent added the closed-duplicate Closed in favor of an existing report label Dec 16, 2016
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 P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants