<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 2012-Aug-31 09:50 , Programmingkid
      wrote:<br>
    </div>
    <blockquote
      cite="mid:D5E8F49E-A38F-4A3F-8883-90A8B73FFA95@gmail.com"
      type="cite">
      <div class="moz-text-html" lang="x-western">
        <div>
          <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
            -webkit-line-break: after-white-space; ">
            <div>
              <div><br>
              </div>
              <div>Are you saying my-variable is better than myVariable?</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Yes.<br>
    <br>
    <blockquote
      cite="mid:D5E8F49E-A38F-4A3F-8883-90A8B73FFA95@gmail.com"
      type="cite">
      <div class="moz-text-html" lang="x-western">
        <div>
          <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
            -webkit-line-break: after-white-space; ">
            <div>
              <div>How do global variables get you in trouble in
                recursion? Do you have an example?</div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Not off-hand, we learn to avoid doing that. To construct one - let's
    take a method doing recursion properly, and break it:<br>
    <tt><br>
      \ Correct way, using stack manipulation<br>
    </tt><tt>: fibonacci ( fib -- return ) recursive</tt><tt><br>
    </tt><tt>   dup 2 >= if</tt><tt>                 ( fib )<br>
    </tt><tt>      dup 1- fibonnaci         ( fib fib-1 )</tt><tt><br>
    </tt><tt>      swap 2 - fibonnaci       ( fib-1 fib-2 )<br>
            +                        ( fib )<br>
         then                        ( fib )<br>
      ;<br>
    </tt><tt></tt><br>
    <tt>\ Incorrect way - using variable "fib", which will get
      overwritten during recursion<br>
    </tt><tt>0 value fib;</tt><tt><br>
    </tt><tt>: fibonnaci ( fib -- return ) recursive</tt><tt><br>
    </tt><tt>   to fib                     </tt><tt>\ to avoid stack
      manipulation<br>
         fib 2 < if<br>
            fib exit<br>
         then<br>
         fib 1- fibonnaci           ( fib-1)<br>
         fib 2 - fibonnaci          ( fib-1 fib-2 )<br>
         +                          ( fib )<br>
      ;<br>
      <br>
    </tt>
    <blockquote
      cite="mid:D5E8F49E-A38F-4A3F-8883-90A8B73FFA95@gmail.com"
      type="cite">
      <div class="moz-text-html" lang="x-western">
        <div>
          <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
            -webkit-line-break: after-white-space; ">
            <div>
              <div><br>
              </div>
              <div>I am not familiar with this alarm level. Could you
                explain what it is? <br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    In IEEE 1275, you can set an "alarm" for a device. This will be
    called asynchronously when the condition in question triggers
    (usually a timer expiring). If you were in the middle of something
    else using global variables, you can get in trouble if those global
    variables area also used in the alarm code. The Serial driver for
    openboot uses alarms, for example.<br>
    <br>
  </body>
</html>