<story><title>Sigils are underappreciated (2022)</title><url>https://raku-advent.blog/2022/12/20/sigils/</url></story><parent_chain><item><author>jerf</author><text>I like to rate programming language&amp;#x27;s features not by how much I use them when I&amp;#x27;m in the given language, or how good they make me feel, but by how much I miss them when I&amp;#x27;m in a different language, once I&amp;#x27;m fluent in that language and writing in the native idiom. (This is important. If you&amp;#x27;re still trying to write X in Y, yes, you&amp;#x27;ll miss the features from X, but that&amp;#x27;s not a useful data point.)&lt;p&gt;By this metric, rather a lot of features turn out to be less important than they may seem at first. Many things are a zero on this scale that I think might surprise people still on their second or third language. From this perspective you start judging not whether a language has this or that exact feature that is a solution to a problem that you are used to, but whether it has a solution at all, and how good it is on its own terms.&lt;p&gt;So while sigils have a lot of company in this, they are also a flat zero for me on this scale. Never ever missed them. I did a decade+ of Perl as my main language, so it&amp;#x27;s not for lack of exposure.&lt;p&gt;(As an example of something that does pass this test: Closures. Hard to use anything lacking them, though as this seems to be a popular opinion nowadays, almost everything has them. But I&amp;#x27;m old enough to remember them being a controversial feature. Also, at this point, static types. Despite my decades of dynamic typed languages, I hate going back to dynamic languages anymore. YMMV.)</text></item></parent_chain><comment><author>derefr</author><text>&amp;gt; So while sigils have a lot of company in this, they are also a flat zero for me on this scale. Never ever missed them. I did a decade+ of Perl as my main language, so it&amp;#x27;s not for lack of exposure.&lt;p&gt;I tend to miss one specific sigil (or pair of sigils): the @ and @@ sigils in Ruby, that mean &amp;quot;instance variable&amp;quot; and &amp;quot;class variable&amp;quot; respectively. Having identifier shadowing between stack-locals, and what Java would call &amp;quot;members&amp;quot; and &amp;quot;statics&amp;quot;, be &lt;i&gt;literally impossible&lt;/i&gt;, is just so nice. Especially when you get it &amp;quot;for free&amp;quot; in terms of verbosity, rather than needing to type `self.class.` or something.&lt;p&gt;I also really quite interned-string-literal : sigils in Ruby&amp;#x2F;Elixir — though I&amp;#x27;d be equally fine with the Prolog&amp;#x2F;Erlang approach of barewords being symbols and identifiers needing to be capitalized. As long as there&amp;#x27;s &lt;i&gt;some&lt;/i&gt; concise syntax for interned strings, especially in the context of dictionary keys. Because otherwise people just won&amp;#x27;t use them, even when they&amp;#x27;re there in the language. (See: Java, Python, ECMA6.)&lt;p&gt;Speaking of Elixir, the &amp;quot;universal sigil&amp;quot; ~ is kind of amazing. Define a macro sigil_h&amp;#x2F;2, and you can suddenly write ~h&amp;#x2F;foo&amp;#x2F;bar (or ~h[foo]bar, or whatever other delimiter works to best avoid the need for escaping), and foo and bar will be passed to sigil_h&amp;#x2F;2 as un-evaluated AST nodes to do with as you please. The language gives you ~w by default (which works like Ruby %w); but more interestingly, Regex literals in Elixir are just sigil_r.</text></comment>
<story><title>Sigils are underappreciated (2022)</title><url>https://raku-advent.blog/2022/12/20/sigils/</url></story><parent_chain><item><author>jerf</author><text>I like to rate programming language&amp;#x27;s features not by how much I use them when I&amp;#x27;m in the given language, or how good they make me feel, but by how much I miss them when I&amp;#x27;m in a different language, once I&amp;#x27;m fluent in that language and writing in the native idiom. (This is important. If you&amp;#x27;re still trying to write X in Y, yes, you&amp;#x27;ll miss the features from X, but that&amp;#x27;s not a useful data point.)&lt;p&gt;By this metric, rather a lot of features turn out to be less important than they may seem at first. Many things are a zero on this scale that I think might surprise people still on their second or third language. From this perspective you start judging not whether a language has this or that exact feature that is a solution to a problem that you are used to, but whether it has a solution at all, and how good it is on its own terms.&lt;p&gt;So while sigils have a lot of company in this, they are also a flat zero for me on this scale. Never ever missed them. I did a decade+ of Perl as my main language, so it&amp;#x27;s not for lack of exposure.&lt;p&gt;(As an example of something that does pass this test: Closures. Hard to use anything lacking them, though as this seems to be a popular opinion nowadays, almost everything has them. But I&amp;#x27;m old enough to remember them being a controversial feature. Also, at this point, static types. Despite my decades of dynamic typed languages, I hate going back to dynamic languages anymore. YMMV.)</text></item></parent_chain><comment><author>Swizec</author><text>Thanks for putting into words something that was on the edge of my mind, but never quite graspable.&lt;p&gt;Two more examples (for me?) of features that I find you really miss in a language even if you’re fluent in the local idioms: First-class functions and pattern matching.&lt;p&gt;Passing functions as values is &lt;i&gt;so nice&lt;/i&gt; and afaik most modern languages have that feature nowadays. But I remember when it used to blow people’s minds.&lt;p&gt;Pattern matching is something I’ve missed ever since having it in Haskell. Such an elegant solution to a problem that you have just often enough that the typical native approach feels clunky.</text></comment>