-
-
Notifications
You must be signed in to change notification settings - Fork 662
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
Vector defaultValue argument #9478
Conversation
I'm worried about code generation on static targets because the argument is optional. In particular, we have to make sure that |
Some way to unwrap it before iteration, like |
Adding optional arguments is technically a breaking change. Also I'm having trouble imagining that |
In what cases this is breaking change? |
It's a breaking change because of a signature change. But that's not important because |
Sorry, forgot to respond.
I was thinking of allocation pools, which doesn't seem that far fetched. But yeah, it's probably not going to affect anyone. I would propose this: abstract Vector<T> {
public function new(size:Int):Void;
public function fill(value:T):Void;// exercise for the writer
static public function prefilled<T>(size:Int, value:T):Vector<T> {
#if xyz
/* fancy xyz-specific magic here */
#else // default implementation
var ret = new Vector(size);
ret.fill(value);
return ret;
#end
}
} |
I'm closing this because I don't think having the Vector constructor loop over its length is acceptable. I'd be fine with adding a separate |
Should fix #8040 and unblock #8495