Reflection in erlang

Lennart Öhman <>
Sat Jan 31 13:31:47 CET 2004


Hi,
there are "secret" functions called module_info/0 and module_info/1
in every erlang module.

Eshell V5.2.3.3  (abort with ^G)
1> lists:module_info().
[{exports,[{append,2},
            {append,1},
            {subtract,2},
            {reverse,1},
            {nth,2},
            {nthtail,2},
            {prefix,2},
            {suffix,2},
...


2> lists:module_info(exports).
[{append,2},
  {append,1},
  {subtract,2},
  {reverse,1},
  {nth,2},
  {nthtail,2},
  {prefix,2},
  {suffix,2},
  {last,1},
...


/Lennart


Corrado Santoro wrote:
> Hi all, 
> I'm looking for an API that allows me to obtain info on a loaded module. In 
> particular I would like to obtain the list of function exported with the 
> arity. 
>  
> I looked at the documentation but I didn't found anything. 
>  
> Could anyone help me? 
>  
> Bye, 
> -Corrado 
>  
> --  
> ====================================================== 
> Eng. Corrado Santoro, Ph.D. 
>  
> University of Catania - Engineering Faculty 
> Department of Computer Science and 
> Telecommunications Engineering 
> Viale A. Doria, 6 - 95125 CATANIA (ITALY) 
>  
> Tel: +39 095 7382364           Fax: +39 095 338280 
>      +39 095 7382365 
>      +39 095 7382380 
>  
> EMail:  
> Personal Home Page: 
>             http://www.diit.unict.it/users/csanto 
>  
> NUXI Home Page: 
>             http://nuxi.iit.unict.it 
> ====================================================== 
> 
> -------------------------------------------------
> This mail sent through IMP: http://www.cdc.unict.it/

-- 
-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : 




More information about the erlang-questions mailing list