Constant values are initial state of any application, whether being a port number or the URL of a network resource, constant values play a major role in any application.
We can use the following patterns to get the most out of them,
We can consider two aspects of a variable when considering it a const,
- Its value doesn't change.
- The way it vibrates.
Pure Const
When our application needs a certain value to be vibrated only once in its whole lifecycle, then it is a pure const.
"My Pure Const Value" $PURE_CONST_EXAMPLE
PURE_CONST_EXAMPLE ?
As you notice the dataflow pipe of our const variable doesn't have a head operator which means it will vibrate only once and it is impossible to vibrate it later.
Semi Const
Using <<<Semi-Const>>> variables still the value will always remain constant but the vibration can happen multiple times.
The simplest example could be
:"My Semi Const Value" $SEMI_CONST_EXAMPLE
SEMI_CONST_EXAMPLE ?
"Trigger" SEMI_CONST_EXAMPLE
If you need to add auto-vibration feature for this const variable on application start then a simple <<<OR Gate>>> becomes quite handy,
:["T", :] "My Semi Const Value" $SEMI_CONST_EXAMPLE
SEMI_CONST_EXAMPLE ?
"Trigger" SEMI_CONST_EXAMPLE
Now the or gate is holding a const value of <<<"T">>> and it will trigger the out const value as soon as the application starts. Also, this gate redirects all incoming head vibrations to our Value Literal causing it to vibrate again.
Scoped Const
Const values have interesting behavior when they are used inside a <<<Wrapper Shell>>>. In this case the wrapper's trigger can trigger their vibration. Let's check this example,
$input {
"Hello World"?
}
Unlike what we expect, this const value will never vibrate because now it is being used inside a shell which has a trigger. Although the value of <<<input>>> is never used but the activation of shell is dependent to it.
If we want to see it vibrating then we should trigger this wrapper shell,
$input {
"Hello World" ?
}
"Trigger" input