Can I define a generic type or procedure, that accepts any type T, _except_ if:

  1. It is, or contains, refs, directly or indirectly. (No "local heap" data)
  2. It has, or contains types with, destructors, directly or indirectly. (Only 
data that is safe to alloc/dealloc on the shared heap)



I think I need this, to make sure I can safely put the data on the shared heap, 
and pass it around in Channels. I don't want to use local heap data that is 
copied by the Channel. Also, I need "any type" Channels, so I just want to 
(have to) pass pointers around. "Ownership" of the data must pass to the 
receiver thread. I'm trying to do this with the current Nim version, even if 
coming changes might make some of this easier/obsolete.

Do I need "concepts" to do the (negative) matching? Is there any example 
anywhere?

Later I'll need to "outlaw" the "int" and "float" types too (and probably also 
raw pointers), to make the format architecture neutral, but I'm still far from 
that.

Reply via email to