[nim-dev] Re: Module Introspection

  • From: Araq <rumpf_a@xxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Tue, 24 Nov 2015 08:05:05 +0000

I don't think there is such a thing called "iterating+introspecting in a
controlled, read-only fashion":

```nim
proc foo = discard "can I modify foo? Who knows, there is a macro invocation
following"

mymacro()
```

*But even for a global macro invocation within the same module, surely
iterating+introspecting in a controlled, read-only fashion over the global
types, procs, etc., that have been defined prior to the macro's point of
invocation (and thus, will affect the context at that point within the
module) can't be a bad thing?*

Surely it is a bad thing. The proper way to do it is to annotate what is
affected by macros like so:

```nim

proc foo {.mymarker.} = ...
```

Rumors are that you can ``{.push mymarker.}`` but this needs to be documented.


Other related posts: