[nim-dev] Re: Macro: enumerate exported functions from a module

  • From: jlp765 <jlp765@xxxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Fri, 21 Oct 2016 13:20:56 +0000

Ok, I will fess up.


I was really thinking that collections like linked lists, queues, rings, ....

where it would be nice if there was a lib you could import, which hoisted lib 
procs (applied by iteration thru each element),

something like

```
import queues, math
import hoisting

hoistLibProcs("queues", "math")   # <- this would make procs from math work 
with queues

var q: Queue
#
# do setup of queue data here
#

let sq = q.sqrt()  # this would take the sqrt() for each element of q (because 
sqrt() has been hoisted)
```

Advantages:
* users choice as to whether hoist proc from a lib (can hard-wire their own if 
they want to)
* don't have to go through enumerating procs from a lib (matches future changes 
in hoisted lib)
* apply to any collection type provided there is a standard collection iterator 
(??)


Other related posts: