Hacker News new | ask | show | jobs
by tremens 3153 days ago
A mix of B and C.

Variables bound within a scope should be able to shadow variables bound in parent scopes, but global vars should be made obvious when they are used within the codebase - visually marking global variables is a good thing.

Example:

  <set var="@x" global>3</set>
  <scope>

      <set var="x">4</set>

      <put>x</put> // 4
      <put>@x</put> // 3

      <scope>
         <set var="x">10</set>

         <put>x</put> // 10
         <put>@x</put> // 3
      </scope>

      <put>x</put> // 4
      <put>@x</put> // 10
  </scope>