Re: Directory/file browser as TreeView
- From: Joe Smith <jes martnet com>
- To: gtk-perl-list gnome org
- Subject: Re: Directory/file browser as TreeView
- Date: Wed, 04 Oct 2006 12:43:40 -0400
A. Pagaltzis wrote:
> ... glad I can help. :-)
Thanks for the most clear lesson; very enlightening!
>> What's the "+" for?
>
> To force parsing as a value. Otherwise, Perl thinks these parens
> belong to `sort`, ... That caught me completely by surprise.
> ...
> You can use the unary plus more or less wherever a pair of
> delimiters is ambiguous.
Completely new to me. Of course I'm used to using "0+ list" to force
scalar context, but I'd never seen the "+(... )" to force sub-expression
context instead of sub call. Interesting. I would probably have ended up
with "sort &no_upwards( @content );" as that's more familiar to me and
it makes it clear that "no_upwards" is a sub, which I never figured out
until I stepped into it with the debugger! Duh. I'm not used to seeing
bareword subs I guess.
Certainly the "+(... )" syntax is clear, once you know the secret--not
unusual for Perl ;-)
> ... However, do this on older
> hardware or with slow filesystems like an NFS mount, and the
> difference will be dramatic. Instead of sitting there like a dead
> duck for 20 seconds or maybe several minutes, the browser will
> remain responsive all along, even if the thing you were looking
> for takes a while to show up.
I can imagine--actually it's cool even on a large local dir to see the
little triangles wink in as the subs complete.
> ..
> But I was attempting to get the GUI side of things right while
> keeping the code simple enough to be instructional, and I think
> what I got is just barely within that constraint as is.
Agreed--right on the edge. Still, I remember (barely) when I first read
K&R and most of the examples were complete gibberish at first, but over
time I learned so much by working through them. Now, more often than
not, I get frustrated with examples that are so obvious they're hardly
worth the space to print them.
Thanks again!
<Joe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]