title: Strange behaviour of declare/typeset with "options" array in zsh
body: <p>I attempted to declare a variable named <code>options</code> in a script for zsh. Turned out that it's some reserved name and zsh stores an associative array under it.</p>
  
  <pre><code>function mcve() {
      options='';
  }
  
  $ mcve
  mcve:1: options: attempt to set slice of associative array
  </code></pre>
  
  <p>Tried to look at its contents with <code>declare</code> and encountered a strange behaviour. The output is different before and after first occurence of the above error.</p>
  
  <pre><code>$ zsh
  $ declare options
  options
  
  $ zsh
  $ mcve
  mcve:1: options: attempt to set slice of associative array
  $ declare options
  options=(autolist on printexitvalue off...&lt;20 more lines&gt;)
  </code></pre>
  
  <p><strong>What's happening? Why is output different? Is the <code>options</code> array declared at the moment of first attempt to use it?</strong></p>
  
  <p>I've heard that <a href="https://stackoverflow.com/a/10195261/2790048"><code>typeset</code> should be used</a> instead of <code>declare</code>, but my <code>man zshbuiltins</code> says they're perfectly equal.</p>
  
  <p>Also, this runs without failure:</p>
  
  <pre><code>function mcve() {
  declare options;
  options='';
  echo ok;
  }
  
  $ zsh
  $ mcve
  ok
  </code></pre>
  
  <p>Why is this different?</p>