Skip to content

Deprecate Str\is_empty #52

@rob0rt

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.

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