Jenkins Shared Pipeline Library : Can I declare static variables in vars file?
<p>Does Jenkins Shared Pipeline Library supports static variables in <code>vars/*. groovy</code> files?</p>

<h1>Examples</h1>

<h2>Referencing global variables "implicitly" (doesn't work)</h2>

<pre><code>file: vars/foo.groovy
---
def functionFoo() {return "foo"}



file: vars/bar.groovy
---
def result = functionFoo()
def functionBar() {println result}


file:Jenkinsfile
---
@Library('MyLib') _
bar.functionBar()
</code></pre>

<p>This throws error:</p>

<blockquote>
  <p>groovy.lang.MissingPropertyException: No such property: result for
  class: groovy.lang.Binding    at
  groovy.lang.Binding.getVariable(Binding.java:63)  at
  org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
    at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
    at
  org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
    at
  com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:24)
    at
  com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
  ....</p>
</blockquote>

<h2>Referencing global variables "explicitly" (does work)</h2>

<pre><code>file: vars/foo.groovy
---
def functionFoo() {return "foo"}



file: vars/bar.groovy
---
def functionBar() {
    def result = functionFoo()
    println result
}


file:Jenkinsfile
---
@Library('MyLib') _
bar.functionBar()
</code></pre>

<h1>Summary</h1>

<p>I assume that variables are either initialized in different way or simply cannot be used withing <code>vars/</code> directory the same way function can. 
Is this feature part of Groovy language? Or a limitation of Jenkins' Global Pipeline Library?</p>