[nim-dev] Re: Constructors via typedesc[] arguments

  • From: jester <linkmonitor@xxxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Tue, 6 Dec 2016 18:21:59 +0000

That's a good point.

I think both cases (generic and specific) have use.

The generic case allows a kind of convention: All types defined by (string,int) 
can create the appropriate *val()* function and get the *new()* function for 
free.

The specific case allows for customization: A type can create a custom *new()* 
and bind it (or not) to a custom *val()* of their choosing.

Other related posts: