Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: How will you use state declared variables in Perl6?

by Juerd (Abbot)
on Nov 05, 2006 at 23:50 UTC ( #582344=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How will you use state declared variables in Perl6?
in thread How will you use state declared variables in Perl6?

My point was that you'd use standard memoization for that, not your own mechanism. In other words: state will (as far as I can estimate) not be used much for memoization, because it's easier to just say "is memoized" or something alike.

Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }


Comment on Re^3: How will you use state declared variables in Perl6?
Re^4: How will you use state declared variables in Perl6?
by TimToady (Parson) on Nov 06, 2006 at 06:07 UTC
    That's currently specced as "is cached" though I don't believe it's implemented yet. However, even after it's implemented, it's not going to be smart enough from the type signature to know whether an incoming parameter is sparse or dense, and for something like fibonacci an array is going to provide a faster memo cache than a hash is. Maybe the memoizing code can be smart enough to figure that out heuristically, but that's not a sure thing at this point.

      I have to admit that I'm dreaming of a code profiler that also tries some optimization strategies, and picks the best for your program. Memoization is already heavily parametrized, and I expect the same things to be possible with "is cached". Perhaps "use a dense array" can be communicated in an argument passed to "is cached"?

      Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://582344]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-08-21 16:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (138 votes), past polls