title: Generics in Object Pascal: types equality
body: <p>I am trying to learn Object Pascal (maybe for hobby projects), and I found that Object Pascal (FreePascal) supports generics in <code>{$mode objfpc}</code>. They look like C# generics, but it seems as there is a difference. When I tried to declare a variable:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>uses Fgl;
  ...
  SomeVariable: TFPSList&lt;string&gt;;
  </code></pre>
  
  <p>I've got error which said me about unexpected '&lt;' and I removed parameter <code>&lt;string&gt;</code> and it passes compilation. So, seems that list of string's and list of int's would be declared in the same way: <code>Something: TFPSList</code>. But this means that Pascal treats both lists as of the same type, right? In C# and other languages type parameter modifies all type and creates new type. I know that old Pascales used containers of pointers as "generic" solution (<code>TList</code>, etc), but <code>TFPSList</code> is a real generic but in the declaration it looks like simple container of pointers. Does modern Pascal (FreePascal, Delphi) distinguish between these generic types (similar to <code>TFPSList</code> of int's/of string's)? If I have generic list of int's does it mean that I can pass it to the function expecting a list of another type and how/where I should check items type: compile time/runtime? I know about <code>is</code> and <code>as</code> keywords, but what to do if list is empty? How to check the type of container's items?</p>
  
  <p>PS. Excuse me if the question sounds strange or stupid, I never used Pascal before.</p>