[nim-dev] Re: Table can not use `object` as key or value

  • From: flyx <nim@xxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Thu, 31 Mar 2016 08:15:57 +0000

I think the point here is that Nim should not be used as if it's Java, because 
it's not. Even Java itself moved from Maps/Lists with Objects to generic types 
in 1.5 (even though they are still awful because of type erasure).

In Nim, if you want a variable to be able to hold values of several different 
types, you can use `object variants 
<http://nim-lang.org/docs/manual.html#types-object-variants>`_. The case where 
you actually want to put *any* type into a variable is exotic and most of the 
time not the ideal solution for the problem at hand.

Other related posts: