#22 new
Philipp Pirozhkov

Methods cannot be invoked from within lambdas or blocks

Reported by Philipp Pirozhkov | February 23rd, 2009 @ 02:18 PM

class Foo def a(x, lambda)

['inside a', x].join(' ').puts()
lambda()
['exiting a', x].join(' ').puts()

def b(y)

['inside b', y].join(' ').puts()

def z

'z'.puts()
a('do something', fun do

b('ccc')

)
'exit z'.puts()

works fine, but uncommenting breaks everything changing 'class' to 'module' fixes everything

stacktrace: exception error: no function clause matching

             reia_r2e:forms({method_call,13,
                             {identifier,13,b},
                             [{string,13,"ccc"}],
                             {identifier,13,'___instance_variables_0'},
                             {identifier,13,'___instance_variables_1'}})

in function reia_r2e:'-forms/1-lc$^5/1-7-'/1 in call from reia_r2e:forms/1 in call from reia_r2e:list_to_forms/2 in call from reia_r2e:list_to_forms/2 in call from reia_methods:method_invocation/4 in call from reia_methods:transform/2 in call from reia_visitor:transform/3

Comments and changes to this ticket

  • Philipp Pirozhkov

    Philipp Pirozhkov February 23rd, 2009 @ 02:20 PM

    
    class Foo
      def a(x, lambda)
        ['inside a', x].join(' ').puts()
        lambda()
        ['exiting a', x].join(' ').puts()
    
      def b(y)
        ['inside b', y].join(' ').puts()
    
      def z
        'z'.puts()
        a('do something', fun do
          b('ccc')
        )
        'exit z'.puts()
    
  • Tony Arcieri

    Tony Arcieri February 28th, 2009 @ 11:43 AM

    • Title changed from “class method is not seen inside a block” to “Methods cannot be invoked from within lambdas or blocks”

    Lambdas should be able to access (but not mutate) the outer scope and hidden ivar state.

    I'll add support for this, with the provision that if a method is invoked which mutates the state it will crash the object.

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