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

AxisAlignedBB is now immutable #95

Merged
merged 13 commits into from
Dec 9, 2024
Merged

Conversation

Dhaiven
Copy link

@Dhaiven Dhaiven commented Dec 3, 2024

Like #90 but for AABB, fix #88

@dktapps
Copy link
Member

dktapps commented Dec 3, 2024

I'd prefer if we kept the *Copy versions. That way, only the people using the mutable functions will get their code broken.

@Dhaiven
Copy link
Author

Dhaiven commented Dec 3, 2024

I said the same thing to myself but i think it's better to keep logic between Vector & AABB.
Vector is immutable and don't have a copy on the name of function return a new vector like add so i thinks it's better to do the same in AABB

@Dhaiven
Copy link
Author

Dhaiven commented Dec 3, 2024

Maybe add @deprecated for *Copy versions and remove them for pmmp 7 for exemple

@dktapps
Copy link
Member

dktapps commented Dec 3, 2024

I said the same thing to myself but i think it's better to keep logic between Vector & AABB. Vector is immutable and don't have a copy on the name of function return a new vector like add so i thinks it's better to do the same in AABB

Vector isn't relevant to this code. Totally different API. If anything, I'd've preferred Vector methods to have Copy suffixes to make it clear how they behave. But again, not relevant.

Maybe add @deprecated for *Copy versions and remove them for pmmp 7 for exemple

I don't want to penalize correct code. There's no point doing a deprecation like that, it's just delaying the inevitable.
Either we keep them permanently, or we remove them now.

If we remove the *Copy() variations

  • bad (mutable) code silently gets a behavioural BC break and possibly stops working
  • good (immutable) code blows up and has to be refactored for no good reason

If we just remove the mutable variants and keep *Copy()

  • bad (mutable) code blows up and has to be refactored (fine)
  • good (immutable) code is unaffected

Copy link
Member

@dktapps dktapps left a comment

Choose a reason for hiding this comment

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

There are now many incorrect @return $this doc comments

src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
@Dhaiven Dhaiven requested a review from a team as a code owner December 3, 2024 20:00
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
Copy link
Member

@dktapps dktapps left a comment

Choose a reason for hiding this comment

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

Looking better, but I think the docs could be cleaned up

Outsets the bounds of this AxisAlignedBB by the specified X, Y and Z.

Returns an expanded clone of this AxisAlignedBB.

can be reworded like

Returns a copy of the AxisAlignedBB with bounds outset by the specified X, Y and Z.

etc

src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
src/AxisAlignedBB.php Outdated Show resolved Hide resolved
Dhaiven and others added 6 commits December 9, 2024 10:36
Co-authored-by: Dylan T. <dktapps@pmmp.io>
Co-authored-by: Dylan T. <dktapps@pmmp.io>
Co-authored-by: Dylan T. <dktapps@pmmp.io>
@dktapps dktapps merged commit f291b4d into pmmp:major-next Dec 9, 2024
2 checks passed
@Dhaiven Dhaiven deleted the AABB-immutable branch December 9, 2024 21:55
@dktapps dktapps mentioned this pull request Dec 30, 2024
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