Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the formal term for the "#{}" token in Ruby syntax?
    text
    copied!<h3>The Background</h3> <p>I recently posted <a href="https://stackoverflow.com/a/10869398/1301972">an answer</a> where I variously referred to <code>#{}</code> as a literal, an operator, and (in one draft) a "literal constructor." The squishiness of this definition didn't really affect the quality of the answer, since the question was more about what it does and how to find language references for it, but I'm unhappy with being unable to point to a canonical definition of exactly what to call this element of Ruby syntax.</p> <p>The <a href="http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#string" rel="nofollow noreferrer">Ruby manual</a> mentions this syntax element in the section on <a href="http://www.ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#exprsub" rel="nofollow noreferrer">expression substitution</a>, but doesn't really define the term for the syntax itself. Almost every reference to this language element says it's used <em>for</em> string interpolation, but doesn't define what it <em>is</em>.</p> <h3>Wikipedia Definitions</h3> <p>Here are some Wikipedia definitions that imply this construct is (strictly speaking) neither a literal nor an operator.</p> <ol> <li><a href="http://en.wikipedia.org/wiki/Literal_%28computer_programming%29" rel="nofollow noreferrer">Literal (computer programming)</a></li> <li><a href="http://en.wikipedia.org/wiki/Operator_%28programming%29" rel="nofollow noreferrer">Operator (programming)</a></li> </ol> <h3>The Questions</h3> <p>Does anyone know what the proper term is for this language element? If so, can you please point me to a formal definition?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload