1. Anders Ruud
  2. love
  3. Issues


Issue #776 resolved

Source:getType / isStatic redundancy

created an issue

I'm thinking Source:isStatic is redundant and could be removed.

Comments (5)

  1. hahawoo reporter
    • changed status to open

    Source:isStatic is inconsistent with Canvas:getType though.

    Both Source's "stream/static" and Canvas's "normal/hdr" construction arguments are gettable-but-not-settable afterwards, and are one of two string constants.

    So I think it should be either Source:isStatic and Canvas:isHDR, or Source:getType and Canvas:getType.

    I like isStatic/HDR because it's super concise:

    if Source:isStatic() then

    Buuut I don't like it because not isStatic/HDR maybe isn't super obvious:

    if not Source:isStatic() then -- Well, what is it? :P
    if Source:getType() == 'stream' then -- Maybe more obvious?

    And maybe it's kind of weird that it's constructed with a string but retrieved with a boolean. (I don't think anything else in the API is quite like that.)

    And also getType can have the same name and do the same thing for Sources and Canvases, which is kind of nice I guess.

  2. Alex Szpakowski

    Canvas:getType includes the (extremely likely) possibility of more types in the future. A better name might (eventually) be Canvas:getFormat.

    The same can't be said for Sources, I don't even know what a third type might be. The string versus boolean argument is ok though.

  3. Log in to comment