Properly extend default_included_properties(::SeaIceModel)#107
Conversation
|
|
||
| import Oceananigans.Architectures: architecture | ||
| import Oceananigans.Models: update_model_field_time_series! | ||
| import Oceananigans.OutputWriters: default_included_properties |
There was a problem hiding this comment.
this was missing... so the method was overwriting the other methods by Oceananigans?
cc @giordano
There was a problem hiding this comment.
It was just another function with the same name, that's usually called "shadowing".
This is the reason why I really don't like the import way of extending functions: you rely on a statement which is far away, and if that's, for example, moved during refactoring...you may never notice it. The Module.function_name(...) =... syntax is perhaps more verbose, but it's (1) local and (2) more explicit about the intent ("look, here I'm extending a function defined in another module"), so yeah, verbosity is on purpose. If with this syntax that function doesn't exist in the other module, you get a loud error during precompilation, instead of silently doing the wrong thing when using import for extending the function.
No description provided.