Skip to content

Define SemiMetric and Metric to be traits rather than types #199

Open
@matthieugomez

Description

@matthieugomez

The package Distances groups distances by their mathematical properties (symmetry and triangular inequality), via the type hierarchy Metric <: SemiMetric <: PreMetric.

This type hierarchy is very limiting. In certain contexts, it makes more sense to group distances by their object of application (for instance string distances), or by their general algorithm (for instance, q-gram distances are a certain type of string distances that operate on qgrams). In StringDistances, I would love to be able to define certain functions on these groups. This is not possible, however, due to the lack of multiple inheritance in Julia.

For this reason, I'd prefer SemiMetric/Metric to be traits, rather than types. This would keep the implementation of pairwise/colwise efficient, while making it easier for external packages to define their own abstract types.

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