Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider defining type alias for dimension (String, String) #43

Open
yim-lee opened this issue Aug 27, 2019 · 1 comment
Open

Consider defining type alias for dimension (String, String) #43

yim-lee opened this issue Aug 27, 2019 · 1 comment

Comments

@yim-lee
Copy link
Member

yim-lee commented Aug 27, 2019

Expected behavior

It should be clear what each String in a dimension tuple represents.

Actual behavior

Saw this code and had to google search to remind myself that dimensions are just key-value pairs:

let dimensions: [(String, String)]

Please consider defining type alias:

typealias Dimension = (key: String, value: String)

let dimensions: [Dimension]

Steps to reproduce

N/A

If possible, minimal yet complete reproducer code (or URL to code)

N/A

SwiftMetrics version/commit hash

1.1.0

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

N/A

@Yasumoto
Copy link
Contributor

Yasumoto commented Oct 4, 2019

Took a quick glance here, and naming this Dimension would collide with the type in Foundation. Maybe we could call it MetricDimension ?

This could be a usability win since we could also add some documentation on the typealias, but it'd be a breaking change. Anyone else have thoughts if this would be helpful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants