* Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> [2021-11-11 16:59:32 +0000]: > It's kindof unfortunate that `state` behaves in this manner, as it > isn't actually very useful. Having stateful subroutines is helpful in some cases, here is a trivial example. Obviously YMMV depending on how crazy one gets, but for a simple FSM it implicitly makes consumer code a lot more natural: https://gist.github.com/oodler577/9ae279734c2377fdc371affe19057d85 > > What you describe is exactly what C calls a `static` variable. Because > it isn't lexical, nor is it dynamic. It exists exactly once. > > I actually wonder whether the keyword "static" should be used here. I thought about that, with my very limited C knowledge, if 'static' is what's actually wanted here. This would not be a terrible concept to consider. > > In any case, it's ~trivial to implement that as a CPAN module as a > pluggable keyword. So I'd suggest someone go do that first, and we'll > see how it goes. > Too rich for my blood x) - but yeah I think it'd be neat to see. Cheers, Brett > -- > Paul "LeoNerd" Evans > > leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS > http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/ -- -- oodler@cpan.org oodler577@sdf-eu.org SDF-EU Public Access UNIX System - http://sdfeu.org irc.perl.org #openmp #pdl #nativeThread Previous | Thread Next