Skip to content

Deprecate Str\is_empty #52

Description

@rob0rt

Functions can't refine input types in Hack, meaning that if the argument to Str\is_empty is non-null, it won't get refined even if the function returns true. This means that the function is, effectively, not valuable, since checking for emptiness via === '' or a nullcheck is more explicit.

We've found this function in practice to confuse developers, who expect type refinement, so we may deprecate this function and suggest explicit equality checks instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions