Renaming list-returning functions in love.physics to be consistent with other functions

Issue #1305 resolved
created an issue

Other functions in LOVE's API which return lists of things are not in the format of "getThingList" but "getThings", i.e. plural nouns.


So, I would suggest that functions in the physics module could be renamed to be consistent with this format:

World:getBodyList -> getBodies
World/Body:getContactList -> getContacts
World/Body:getJointList -> getJoints
Body:getFixtureList -> Body:getFixtures

Comments (5)

  1. Mi 28

    What's up with you and asking to rename things? The getEffectsList existed specifically because getWhateversList was already an established pattern in the framework, now not only does it not follows the suite, you're also suggesting that all functions of this kind be renamed? Are you trying to deliberately sabotage any backwards compatibility the new version would have had? If you pick a way something works, you stick to it, because otherwise you will make a lot of people very upset so there better be a very good reason for doing this.

  2. hahawoo reporter

    In regards to getEffectsList existing specifically because getWhateversList was already an established pattern:

    I know. This pattern was used in the physics module. There was also another, more common pattern in the API: getWhatevers. Because these are two patterns for the same thing, I'm proposing that there be one, for the benefits that consistency gives.

    Backwards compatibility is a nice thing, because people don't have to change their code to benefit from the latest version of LOVE.

    Having the best API possible is also a nice thing, and this can result in breaking backwards compatibility.

    So, should an API strive for backwards compatibility, or strive for the best API possible? I think that LOVE strives for the best API possible, and often things get removed or renamed in minor releases. I think this is the appropriate thing to do for LOVE. LOVE also deprecates functions in revision releases, which allows some time for code to change while still using the latest version.

    By the way, I took the "deliberately sabotage" bit as a friendly joke, but I would be careful joking like that with strangers on the internet who might have different personalities or come from different cultures because someone might misinterpret it and get hurt feelings and not want to talk to you. But I like you, so feel free to joke with me like that anytime. :)

  3. Gabe Stilez

    Raidho's a salty ass tough :3, but in the end, you can't really tell whether it was sarcasm or not, from just text.

    As for sabotaging backwards-compatibility and Löve's purpoted goal having the "best" API is both a bit subjective in my opinion.

    I mean, sometimes i agree with you, @hahawoo , regarding renames, and sometimes i don't; it always depends. Consistency is always nice, but sometimes, shorter names win.

  4. Bart van Strien

    Rename love.physics getObjectList functions to getObjects (resolves #1305)

    World:getBodyList -> World:getBodies World:getContactList -> World:getContacts World:getJointList -> World:getJoints

    Body:getFixtureList -> Body:getFixtures Body:getContactList -> Body:getContacts Body:getJointList -> Body:getJoints

    Marked the old functions as deprecated

    → <<cset e6501dbf1377>>

  5. Log in to comment