Skip to content

Conversation

@JohnDowson
Copy link

No description provided.

@ambuc
Copy link
Owner

ambuc commented Dec 1, 2023

I don't like that Area::new(width: U, height: U) constructs an area anchored at (1,1) by default. That feels like a footgun to me. One of the things I liked about the builder pattern and derive_builder is (was?) that it makes it hard to forget to do things like call .at_point().

Is this API change a necessary prerequisite to the overlapping/nonoverlapping changes you want to make down the line? If not, I'd prefer to leave this as it is. If so, maybe you can help me understand what needs to change first before we can make the overlapping/nonoverlapping changes you really want to make.

@JohnDowson
Copy link
Author

While I see your argument, that's directly opposite of the pattern's usual application: making it easier to build types that have many optional fields.

No, it is not a prerequisite, just what I deem to be an improvement in ergonomics.

Alternative solution to reminding people to construct correct areas I see, is making the only way to constrict an Area:

let point = ...;
let area = point.expand_to(w, h);

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

Successfully merging this pull request may close these issues.

2 participants