# New Ticket Created by "jason switzer" # Please include the string: [perl #65346] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=65346 >
I ran into a bug where I couldn't refer to 'self' when it logically made sense I could: (15:33:15) s1n: rakudo: class A { has %.H = (a => -> $x { self.c($x) }); method c($c) { say "got $c" }; method test { %.H<a>.("foo").say; }; }; A.new().test(); (15:33:20) p6eval: rakudo cddb16: OUTPUT«Lexical 'self' not foundcurrent instr.: 'parrot;A;_block27' pc 243 (EVAL_24:111)» (15:33:54) masak: s1n: in fact, 'self' is not defined at the place you're using it. (15:34:04) masak: s1n: only use it from within methods. (15:34:36) moritz_: but why? `self' in class should just refer to the class (formerly proto object), no? (15:34:47) masak: hm. (15:34:51) s1n: it exists, it should (15:34:56) masak: rakudo: class A { self } (15:35:00) p6eval: rakudo cddb16: OUTPUT«Lexical 'self' not foundcurrent instr.: 'parrot;A;_block20' pc 94 (EVAL_18:66)» I am sure there are far simpler test cases. jnth++ agrees that people may be burned more often than not with the current behavior of self. -Jason "s1n" Switzer