title: How to match ets:match against a record in Erlang?
body: <p>I have heard that specifying records through tuples in the code is a bad practice: I should always use record fields (<code>#record_name{record_field = something}</code>) instead of plain tuples <code>{record_name, value1, value2, something}</code>.</p>
  
  <p>But how do I match the record against an ETS table? If I have a table with records, I can only match with the following:</p>
  
  <pre><code>ets:match(Table, {$1,$2,$3,something}
  </code></pre>
  
  <p>It is obvious that once I add some new fields to the record definition this pattern match will stop working.</p>
  
  <p>Instead, I would like to use something like this:</p>
  
  <pre><code>ets:match(Table, #record_name{record_field=something})
  </code></pre>
  
  <p>Unfortunately, it returns an empty list.</p>