Issues

Issue #776 resolved

Source:getType / isStatic redundancy

hahawoo avatarhahawoo created an issue

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

Comments (5)

  1. Alex Szpakowski

    I added Source:getType while somehow forgetting Source:isStatic existed already actually, so I'll probably just remove the former in the interest of inertia.

  2. hahawoo
    • 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.

  3. 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.

  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.