Skip to content

initialize the type, not the instance #1

@visr

Description

@visr

All BMI functions expect model as their first argument, which is used to dispatch to the right implementation. This model argument should generally be an instance of a particular model type, rather than the type itself.

However initialize is a bit different than the rest, since we cannot expect that users can initialize model instances through other means than BMI.initialize. Therefore we should allow to also define initialize on the model type:

BMI.initialize(::Type{MyModel}, config_file) = ...
BMI.update(::MyModel) = ...

We should update this in the test code, but also clarify this in the README example. Since the functions themselves are defined for Any argument types, no change is needed there, unless we want to clarify this distinction in the fallback error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions