Issues

Issue #592 invalid

Renaming checkMode to something which starts with "is" or "has"

hahawoo
created an issue

I think if love.graphics.checkMode were named love.graphics.isModeSupported it would be more consistent with other functions.

Comments (8)

  1. Landon Manning

    I agree with this. The "is" boolean naming scheme would add to the API's naming consistency. Current examples below:

    isCreated
    isDirectory
    isDown
    isFile
    isGrabbed
    isPlaying
    isVisible
    
  2. hahawoo reporter

    has is only used for love.graphics.hasFocus as far as I know. I'd almost propose that hasFocus should be renamed to isFocused, then there would be a single prefix for functions which return a single boolean value. EDIT: There is also love.window.hasMouseFocus.

    However, hasFocus has nicer grammar than isFocused IMO, whereas I don't think hasMode has nicer grammar than isModeSupported.

    isModeSupported kind of translates to is (this) Mode Supported (by the system), whereas hasMode... I'm not really sure... it almost seems like has (the system got this) Mode which I don't think quite makes sense.

    love.graphics.isModeSupported is also consistent in a sense with love.graphics.isSupported.

    If consistency with getModes in an issue, perhaps that could be renamed to getSupportedModes? More verbose, but perhaps it's worth it because it's more descriptive?

  3. hahawoo reporter

    Woah, so these boolean-returning functions can either be read as statements or as questions, I don't think I've noticed this before!

    For example, you could read hasFocus as [Window]hasFocus or as has[window got]Focus[?], or you could read Source:isStatic as [Source]isStatic or is[Source]Static[?].

    (I think I've generally internally read these as "questions", not really "saying" them as if they were questions but more like reading them with the grammar of questions. Maybe? :P)

    isModeSupported reads well as a question (is[this]ModeSupported[by the display]?) but doesn't read well as a statement.

    hasMode reads well as a statement ([The display]hasMode[support for this], or maybe [The display]has[this]Mode[in its supported modes], I don't think I've made the perfect English translation but I think it's something like this? But even without trying to translate it exactly to grammatically correct English, I can still see it reads well as a statement. Also, maybe hasModeSupport is the equivalent to isModeSupported?), but it doesn't read so well as a question.

    It seems all of the other boolean-returning functions I've seen in the API read well in both interpretations. I think it might be because other functions have an implied thing they're related to, like a method has the implication of being related to an object, and isFile has the implication of being related to its argument, and love.window.isCreated has the implication of being related to the window.

    Actually, that makes me think... what about love.window.isSupported?

  4. Log in to comment