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.

Methods cannot be invoked from within lambdas or blocks

#22

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

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

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

Activity

  1. Philipp Pirozhkov
    Philipp Pirozhkov
    
    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()
    

    February 23rd, 2009 @ 02:20 PM

  2. Tony Arcieri
    Tony Arcieri
    • 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.

    February 28th, 2009 @ 11:43 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.