#7 ✓resolved
Philipp Pirozhkov

Object fails calling methods

Reported by Philipp Pirozhkov | November 25th, 2008 @ 03:28 PM

The current test/core/object.re works fine, but if we added the following (two last rows):


class StateHolder
  def get_val
    @val

  def set_val(val)
    @val = val

  def p
    Local.puts(get_val())

and this code fails:


    obj = StateHolder.start()
    obj.set_val('aaa')
    Local.puts(obj.get_val())
    obj.p()

on the last row with the following exception: StateHolder:9: function get_val/0 undefined Object exception: {exception,{error,undef}} stacktrace: [{'StateHolder',start,[]},

         {erl_eval,do_apply,5},
         {reia_erl,erl_funcall,3},
         {'Eval',exprs,2},
         {'Eval',string,1},
         {'Loader',eval_input,1},
         {init,start_it,1}]

Comments and changes to this ticket

  • Philipp Pirozhkov

    Philipp Pirozhkov November 25th, 2008 @ 03:53 PM

    this is most probably the problem i though is lambda related:

    
    class Context
      def context(title, lambda)
        @context_title = title
        lambda()
    
      def local(title)
        Local.puts([@context_title, title].join('/'))
    
    Context.start('a', fun do
      local('b')
    )
    

    this should probably work fine and output 'a/b', but it fails too:

    
    exception: {exception,{error,undef}}
    stacktrace: [{'Context',start,[{string,<<"a">>},#Fun<erl_eval.20.67289768>]},
                 {erl_eval,do_apply,5},
                 {reia_erl,erl_funcall,3},
                 {'Eval',exprs,2},
                 {'Eval',string,1},
                 {'Loader',eval_input,1},
                 {init,start_it,1},
                 {init,start_em,1}]
    
  • Tony Arcieri

    Tony Arcieri December 29th, 2008 @ 11:09 PM

    • State changed from “new” to “resolved”

    Phew... this required a lot of sneaking state around internally. "Local" method invocations are now implemented as function calls (as a gen_server can't call itself). This also has the advantage that HiPE should be able to inline these sorts of calls.

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Reia a dynamic scripting language for the Erlang virtual machine (BEAM)

People watching this ticket

Pages