title: Groovy - GString being used as key versus String as key, subscript notation versus put method
body: <p>In the <a href="http://www.groovy-lang.org/single-page-documentation.html" rel="nofollow noreferrer">groovy documentation</a>, it mentions that using a GString for a key is bad:</p>
  
  <pre><code>def key = 'some key'
  def map = [:]
  def gstringKey = "${key.toUpperCase()}"
  map.put(gstringKey,'value')
  assert map.get('SOME KEY') == null
  </code></pre>
  
  <p>However, simply changing the put() method to use subscript notation:</p>
  
  <pre><code>def key = 'some key'
  def map = [:]
  def gstringKey = "${key.toUpperCase()}"
  map[gstringKey] = 'value' // here
  assert map.get('SOME KEY') == null
  </code></pre>
  
  <p>is enough to cause the assert to fail. How are the semantics any different between using [] and the put() method? Does subscript notation have some sort of implicit cast to String maybe?</p>