Skip to content

ColumnCopier API is confusing #274

Closed
@svick

Description

@svick

ColumnCopier has a constructor that takes a sequence of strings and another constructor that takes a sequence of pairs of strings.

This means that both of the following lines are valid, with different meanings compile:

new ColumnCopier("foo", "bar")
new ColumnCopier(("foo", "bar"))

It seems this API is confusing to people who are learning about ML.NET, as evidenced by these two issues on the docs repo: dotnet/docs#5628, dotnet/docs#5671. There is also #189 about the same issue.

Could the API be changed somehow to make it clearer?

One option would be to remove both constructors and make AddColumn fluent. E.g. the two examples above would change to:

new ColumnCopier().AddColumn("foo").AddColumn("bar")
new ColumnCopier().AddColumn("foo", "bar")

This makes the API more verbose, but maybe it would be worth it to make it clearer?

I'm also assuming that API breaking changes are acceptable at this point. If they're not, then there's probably nothing that can be done.

Metadata

Metadata

Assignees

Labels

APIIssues pertaining the friendly API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions