The HACK language code is generally written in one of the three modes:
Strict
Partial
Decl
Unsafe
These modes provides the developers the flexibility to convert their PHP code to Hack and allow the developers to write Hack Code that can call a non-Hack code.
All modes are case sensitive.
Strict Mode:
In Strict mode the Hack type checker will catch every possible type error.
The code written in Strict mode cannot call into non-Hack code.
Indicating the block of Hack code uses Strict Model: Use //strict at the beginning of the Hack file.

Partial Mode:

This is the default Hack mode.
Allows partial typing of class, methods and functions.
All programmers to call non Hack code.

Decl Mode:

Decl mode is generally used when annotating old, existing APIs.
Decl mode allows Hack code written in a Strict mode to call into legacy code without fixing the issues that would be pointed out by partial mode.
Indicating the block of Hack code uses Strict Model: Use //decl at the beginning of the Hack file.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.