Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

unable to call class's module_info

#27

After latest block changes, it's unable to call class's module_info function:


>> load('home.re')      
=> Home
>> Home.module_info()   
exception error: undefined function 'Home':module_info/2
  in function  erl_eval:do_apply/5
  in call from eval_shim:exprs/2
  in call from reia_erl:erl_funcall/3
  in call from 'Eval':exprs/2

exception claims that i'm trying to call /2 function, while i'm trying to call /0


>> Home.module_info(:compile)
exception error: undefined function 'Home':module_info/2
  in function  erl_eval:do_apply/5
  in call from eval_shim:exprs/2
  in call from reia_erl:erl_funcall/3
  in call from 'Eval':exprs/2

calling with argument results in the same exception

the workaround for that could be an info() function for a class/module, since Reia itself should provide that kind of info, and not to be bound tightly to the underlying erlang vm

what is exactly required is the last_loaded timestamp:


[_,_,(:time,last_loaded),_] = reia::apply(controller, :module_info, [:compile])

Reported by Philipp Pirozhkov · March 29th, 2009 @ 03:38 PM

State: resolved
Milestone: none
Assigned to: Tony Arcieri Tony Arcieri

Activity

  1. Philipp Pirozhkov
    Philipp Pirozhkov
    • Assigned user set to Tony Arcieri

    March 29th, 2009 @ 03:38 PM

  2. Tony Arcieri
    Tony Arcieri
    • State changed from new to resolved

    I added a hack to facilitate calling module_info the way it worked before for the time being. Expect this to get merged into the reflection functions for modules and go away in the future. Reopen if it's not working the way it did before.

    March 30th, 2009 @ 12:25 AM

  3. Philipp Pirozhkov
    Philipp Pirozhkov

    Still fails:

    
    reia::apply(controller, :module_info, [:compile])
    

    same as:

    
    Home.module_info(:compile)
    

    Yes, it's a workaround to make a laaaaaarge pattern matching, but that looks too ugly

    March 30th, 2009 @ 03:47 PM

  4. Tony Arcieri
    Tony Arcieri

    Okay, pull again and you should be able to pass a parameter to module_info just like you can in Erlang, e.g:

    
    Object.module_info(:compile)
    

    Also note you don't need anything ugly to get that out of the returned module_info() data... this will get it for you:

    
    compile_info = [info | (:compile, info) in Object.module_info()][0]
    

    If you want to get to the time from the raw module_info structure, you can use:

    
    time = [[time | (:time, time) in info] | (:compile, info) in Object.module_info()][0][0]  
    

    March 30th, 2009 @ 04:01 PM

  5. Philipp Pirozhkov
    Philipp Pirozhkov
    • Tag changed from block to dispatch

    thanks for nice list comprehension tip!

    but module_info call still doesn't work using meta-call:

    
    Binary.module_info()
    @@@ works fine
    

    reia::apply(:'Binary', :module_info, []) @@@ fails with:

    
    exception error: undefined function 'Binary':module_info/2
      in function  reia:apply/4
      in call from reia_erl:erl_funcall/3
      in call from erl_eval:do_apply/5
      in call from eval_shim:exprs/2
      in call from reia_erl:erl_funcall/3
      in call from 'Eval':exprs/2
    

    Looks like reia:apply/3 calls apply/4 and it calls erlang:apply(:'Binary', :module_info, [{}, nil]) that is unexpected by Binary to accept block and empty hash, too

    do not take this into account if there will be a different solution later, i have an erlang::apply instead of reia::apply workaround for that

    April 6th, 2009 @ 11:08 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.