Isolator

Source: reference-book. Raw markdown: /raw/docs/reference-book/6-wrappers/isolator.md

An <<<isolator>>> is a closed shell whose vibrations cannot exit from it. Meanwhile, it is able to re-use variables from outside.

This shell can be used to segregate different parts of our code. Let's see how it works by an example:

"Outside the Shell" $myVariable
myVariable:?
{
  "Inside the shell" $myVariable
  myVariable:?
}

Running the code,

""" sim -f isolator.art """ Outside the shell Inside the shell !!!!

As you can see, two different variables are declared and vibrated independently because we have a shell that is creating a new isolated space.

An <<<isolator>>> can still use a variable from the outer space (scope) if it is not declared within its space. For example, the following code will still print the value which is declared outside this shell.

The concept of isolation will become more clear once we meet two other types of shells, but when a variable is explicitly used inside a shell then there is nothing to stop accessing the vibrations of that variable.

"Outside the Shell" $myVariable
{
  myVariable ?
}

The concept of activation will be checked in next sections but let's just remember an isolator shell is active if its parent is active.

$$$AlertBox type=HINT title=No Internal Access message=An isolator shell is closing all kind of access to its internal elements.$$$