id | keywords | name | summary | category | ||
---|---|---|---|---|---|---|
open |
| open | This is the `open` keyword. | languageconstructs |
open
is used to expose all values, types, modules, etc of a module in the current scope. This is useful whenever you want to use a module's functionality without typing out the module name over and over again.
In some cases, open
will cause a "shadow warning" due to existing identifiers and types being redefined by an open
ed module. You can explicitly ignore that warning by using an open!
statement instead.
<CodeTab labels={["ReScript", "JS Output"]}>
openMath// Use _PI and pow_float from the Math moduleletarea=radius=>Constants.pi*.pow(radius, ~exp=2.0)
functionarea(radius){returnMath.PI*Math.pow(radius,2.0);}