swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.76k stars 1.35k forks source link

Use of `CustomStringConvertible` as a constraint is nearly always wrong. #6880

Open dabrahams opened 1 year ago

dabrahams commented 1 year ago

Description

Instances like this (and many others) are creating needless constraints. Everything is convertible to a string; a conformance to CustomStringConvertible (which is fine) just means the user wanted to customize the default result. This anti-pattern should be removed.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

No response

neonichu commented 1 year ago

Looks like we made this API as well :/

dabrahams commented 1 year ago

Loosening constraints is not API-breaking

grynspan commented 1 year ago

Even if it were, we could just provide extra overloads taking [Any] instead of [any CustomStringConvertible] and map the existing overloads to the new ones, so I think it'd be fine?