# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #123060] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=123060 >
<masak> is there a recent spec commit for `$` in non-signature use? I can't seem to find it by skimming the spec log. <masak> ISTR it being this year, so I shouldn't even have to look that far back. <masak> ah, found this: https://github.com/rakudo/rakudo/commit/ce263122bc0ae6e2fee51c166c06abd9d00ba771 <masak> that one only *speculates* that the semantics be `state $`, though. <masak> I haven't found a spec or decision about it. <masak> right now the semantics seems to be `my`... <masak> m: sub foo { ($ = "A")++ }; say foo for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«AAAAA» <lizmat> m: sub a { $++ }; say a; say a # I think that's state by default <camelia> rakudo-moar 315ec6: OUTPUT«01» <masak> waitwait <masak> lizmat: how is yours qualitatively different from mine? <lizmat> not by much <masak> the only difference I see is the assignment. <masak> and yet they have different behaviors. o.O <lizmat> I'd say, yours is NYI * masak submits rakudobug <masak> something is *very* fishy there. <lizmat> m: sub foo { ($ = 0)++ }; say foo for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«00000» <vendethiel> masak: it's my $; not state $ <vendethiel> (bare $ is, I mean) <masak> vendethiel: what makes you say that? <masak> vendethiel: see lizmat++'s first eval. <vendethiel> seeing the commit that added it to rakudo :-) <vendethiel> and telling TimToady: NOT TO MAKE IT STATE :P <masak> huh. <masak> why not? <lizmat> m: sub a { $++ }; say a for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«01234» <masak> seems it is in some cases... <vendethiel> masak: ETOOMUCHMAGIC. <vendethiel> ETOOIMPLICIT <lizmat> fwiw, I'm fine with state, as my wouldn't make much sense <masak> I'm fine with state, too. <masak> I can see where vendethiel is coming from, but I don't mind much. <vendethiel> newcomers will mind... <masak> if I can write `$++` instead of `(state $)++` 500 times before I die, that will be worth it :) <vendethiel> ++state is cool too :p <vendethiel> or er, state++ <masak> m: sub foo { ++$ }; say foo for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«12345» <vendethiel> m: sub a { state++ }; say a for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«===SORRY!=== Error while compiling /tmp/7a8JxXYEd3Malformed state [...] <vendethiel> m: sub a { (state)++ }; say a for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«===SORRY!=== Error while compiling /tmp/8nHJRjW3siMalformed state [...] <vendethiel> meh. <masak> declarators don't work that way. <masak> they want a declaratee. <vendethiel> and when do they want it <masak> vendethiel: I mean, I can't think of a single case where you write a declarator (`my`, `our`, `state`, `has`, etc) and then nothing afterwards. it feels "wrong", parsing-wise. <vendethiel> well, semantics-wise for me <lizmat> m: sub a { (state $ = "A")++ }; say a for ^5 <camelia> rakudo-moar 315ec6: OUTPUT«ABCDE» <lizmat> m: sub a { ($ = "A")++ }; say a for ^5 # should just be the same <camelia> rakudo-moar 315ec6: OUTPUT«AAAAA»