Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Avoid Boxing for Constructor Invocations #5

Open
matthias-springer opened this issue Oct 3, 2016 · 0 comments
Open

Avoid Boxing for Constructor Invocations #5

matthias-springer opened this issue Oct 3, 2016 · 0 comments

Comments

@matthias-springer
Copy link
Contributor

matthias-springer commented Oct 3, 2016

When calling a generic constructor factory (the generated methods that start with _new), all parameters of type of a type variable are boxed implicitly. This should be avoided. Instead, get rid of the generic factory and call a specialized constructor directly (if it is fixed as described, it would probably also fix #4).

This only applies to constructors but not factories (Constructor factory != factory constructor)! Generic method specializations (#6) could be used to get rid of boxing when calling a factory constructor.

E.g.:

class A<T> {
    T variable;
    A(this.variable);
}

new A<int>(42);   // 42 is boxed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant