While going through one of the threads, I found this:

defmodule MyAgent do
  use Agent, restart: :transient
  # Generated on: use Agent  # def child_spec(opts) do  #   %{id: MyAgent, 
start: {__MODULE__, :start_link, [opts]}, restart: :transient}  # end

  def start_link(opts) do
    Agent.start_link(fn -> %{} end, opts)
  end

  ...end

Notice the commented portion starting with "# Generated on: use Agent". The 
code generated by macro "use Agent" is neatly present as comments. Anyone can 
inspect the code and understand what is happening behind the scene.

Some details:
1) Widely used and straightforward macros like if, def, defmodule etc. are 
excluded. The focus should be on documenting only those macros, which are 
application specific (like use Ecto.Schema)
2) Whenever the command is run (let's call it "mix annotate"), it goes through 
source code directory (lib folder primarily) and recreates annotated code files 
(mixed with commented macro code) in a separate folder. It should not modify 
the existing source files. 
3) Since macros usually take options, there can be a new option like "use 
Agent, annotate: true". This way only those macros are expanded which are 
explicitly marked for annotation.
4) Similarly there can be a module attribute like "@annotate true" or 
"@annotate false". This way individual modules can be explicitly marked for 
annotation. 

thanks
miwee

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/2491efbe-55b3-4c95-be32-860a84b0a527%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to