Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Non-const default values for static / top-level methods #3687
This issue was originally filed by @seaneagan
It would be nice if parameter default values of static/top-level methods could be lazily initialized, probably on the first time the method is called without passing the parameter, the same way that static variables are. For example, you may want to have a parameter default value be the value of a static variable which is lazily initialized.
This probably leads to unexpected behavior:
If we implement lazy initialization for default-values as you describe we would allocate the map only once. This is, however, completely contrary to what most programmers would expect.