Skip to content

Discussion: input and output argument type casting #5

@AartGoossens

Description

@AartGoossens

@sladkovm This is the discussion we started before. Shall we continue here?

For algorithms it is possible to accept multiple input argument types and cast them to a desirable type and cast the output to a type similar to the input type (example of a method that does this in the vmpy source code).

Benefits:

  • Usage of the algorithms is more straightforward when you don't have to worry about the input types
  • ...

Drawbacks:

  • Input argument type is part of the interface specification. Allowing multiple input types might make the interface vague
  • It is not possible to accept all input types. How do we communicate what is/is not possible?
  • Unittesting for multiple input types is a hassle
  • ...

I have a preference for accepting (i.e. developing for) one input type.

Alternative solution: It might be possible to add input and output argument type casting by decorating the algorithms "on the fly" by calling a helper function after import (sort of similar to this). It's not the cleanest way to do it but it might work, I'll try to make a POC for this. For me this would solve the drawbacks and it would still offer input/output type casting for users that do want it.

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