9
badwolf
3y

Sometimes you just make the stupid mistakes

Comments
  • 2
    I guess because the variable name doesn't hint the type. A variable like isAvailable is most likely a boolean. This is a value from a dictionary which could be any type and automatic type conversion could save your ass at runtime.
  • 0
    Which language? For some languages this would avoid casting to bool implicitly and fail for "truthy" values like ['an array', 'with', 'content'].

    Edit: I would accept the diff above for any language where it can make a difference and you are expecting a boolean. Explicit is better than implicit.
  • 1
    @zvyn i understand that. It's ruby btw. However, i still feel it was unnecessary. The reviewer was right.
Add Comment