Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: Code Folding

by eric256 (Parson)
on Dec 30, 2008 at 21:37 UTC ( [id://733344] : note . print w/replies, xml ) Need Help??

in reply to Re^2: Code Folding
in thread Code Folding

I don't think you do acheive the same result, though i havn't managed to get the wX library to install so i'm not sure.

sub test { # 5 important lines while ($x) { # 10 lines of good stuff } for (1..5) { # 100 lines of crap } }

Now if you fold that recursively you get

 sub test { ... }

and then a recursive unfold yeilds to original back. However a non recursive unfold returns

sub test { # 5 important lines while ($x) { ... } } for (1..5) { ... } }

So there are cases where a user might want a recursive fold/unfold, and other where they do not. Now if you through in remembering the fold state, maybe i've already folded the "100 lines of crap" but i left "10 lines of good stuff" unfolded. If i did a non recursive fold on test, and then a nonrecursive unfold i would still be able to see my "5 important lines" and the "10 lines of good stuff" but the "100 lines of crap would not be unfolded". If however you alwas do a recursive fold/unfold then as soon as i unfold test it unfolds my "100 lines of crap"

Eric Hodges

Replies are listed 'Best First'.
Re^4: Code Folding
by sir_lichtkind (Friar) on Jan 01, 2009 at 23:53 UTC
    because both loops are siblings in node hierarchy they get both folded by my new shiny sibling fold. differences appear just when you open the loops. if folded recursive you only see next level und can unfold further. if choden sibling fold you get all at once, because no further folding was done. but there are cases when recursive has advantages. thatsway i added it too.(see update above.)

    thank you too for answering.

    Kephra, a beautiful Perl Editor, designed along Perl like Paradigms lives at