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

The Great Renaming of Map.AttributeType. #105

Merged
merged 2 commits into from
Sep 7, 2021
Merged

Conversation

paddycarver
Copy link
Contributor

Maps don't have an AttributeType in cty. They have an ElementType. In my
wayward youth of like a year ago, I decided this was A Mistake and in my
great and everlasting wisdom, I changed it to AttributeType. I think my
rationale was that elements are integer-indexed and attributes are
string-indexed.

My hubris has bitten me. This was a bad take. It makes diagnostics weird
(why am I using an ElementKeyString instead of an AttributeName if it's
an attribute?) and deviates with basically no value.

Worse, it's just... wrong. Attributes are structural in nature, like
properties in Go structs. They're defined by the provider developer.
Elements aren't structural, like Go maps. The type has no constraint on
what keys or how many keys can be used. Maps are obviously this second
thing.

This is the great renaming, that will break everything but will finally,
finally correct my blunder.

Maps don't have an AttributeType in cty. They have an ElementType. In my
wayward youth of like a year ago, I decided this was A Mistake and in my
great and everlasting wisdom, I changed it to AttributeType. I think my
rationale was that elements are integer-indexed and attributes are
string-indexed.

My hubris has bitten me. This was a bad take. It makes diagnostics weird
(why am I using an ElementKeyString instead of an AttributeName if it's
an attribute?) and deviates with basically no value.

Worse, it's just... wrong. Attributes are structural in nature, like
properties in Go structs. They're defined by the provider developer.
Elements aren't structural, like Go maps. The type has no constraint on
what keys or how many keys can be used. Maps are obviously this second
thing.

This is the great renaming, that will break everything but will finally,
finally correct my blunder.
@paddycarver paddycarver added the breaking-change This will impact or improve our compatibility posture label Sep 4, 2021
@paddycarver paddycarver added this to the v0.4.0 milestone Sep 4, 2021
@paddycarver paddycarver requested a review from a team September 4, 2021 06:19
Copy link
Member

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me 🚀

@paddycarver paddycarver merged commit bb06972 into main Sep 7, 2021
@paddycarver paddycarver deleted the paddy_fix_map_sins branch September 7, 2021 16:30
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change This will impact or improve our compatibility posture
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants