Re: Idea: minor %hash changes

2000-08-31 Thread Tom Hughes
In message <[EMAIL PROTECTED]> Nathan Torkington <[EMAIL PROTECTED]> wrote: > Tom Hughes writes: > > I must admit it had never occurred to me that somebody might > > deliberately use keys or values to achieve that, but I guess > > somebody might be relying on it without realising it. >

Re: Idea: minor %hash changes

2000-08-31 Thread Tom Hughes
In message <[EMAIL PROTECTED]> Jerrad Pierce <[EMAIL PROTECTED]> wrote: > >As far as I can tell reset %x currently tries to reset any > >variables which start with either % or x even though no variable > >can start with %... > > ~/perl > ${"%percent"} = "Quoth the raven"; > print ${"%pe

Re: Idea: minor %hash changes

2000-08-30 Thread Jerrad Pierce
>As far as I can tell reset %x currently tries to reset any >variables which start with either % or x even though no variable >can start with %... ~/perl ${"%percent"} = "Quoth the raven"; print ${"%percent"}, "\n"; reset("%"); print ${"%percent"}, "\n"; Quoth the raven Sure looks like it starts

Re: Idea: minor %hash changes

2000-08-30 Thread Nathan Torkington
Tom Hughes writes: > I must admit it had never occurred to me that somebody might > deliberately use keys or values to achieve that, but I guess > somebody might be relying on it without realising it. while (($k,$v) = each %foo) { last if ...; } keys %foo;# reset the iterator w

Re: Idea: minor %hash changes

2000-08-30 Thread Tom Hughes
In message <[EMAIL PROTECTED]> Nathan Torkington <[EMAIL PROTECTED]> wrote: > Resetting an each() should be done in some other way than calling > keys() or values(). Perhaps reset(%hash)? I'm subfond of the current > reset() semantics (symbol table crackheadery + single-match regexp >

Re: Idea: minor %hash changes

2000-08-30 Thread Tom Christiansen
>Tom Christiansen writes: >> But %hash->BUCKET_USE() should return what's currently there. >Do you really use this information? Really? I have no objection >to supplying a way to discover it, but this might even be in an >external module rather than built into the language given how rarely >it'

Re: Idea: minor %hash changes

2000-08-30 Thread Nathan Torkington
Tom Christiansen writes: > But %hash->BUCKET_USE() should return what's currently there. Do you really use this information? Really? I have no objection to supplying a way to discover it, but this might even be in an external module rather than built into the language given how rarely it's used

Re: Idea: minor %hash changes

2000-08-30 Thread Tom Christiansen
>I was against the idea of hash context, but I'd love it if: > foreach ($k,$v) (%hash) { >... > } I'd like for Perl to emit a warning if people try for (%hash) or its aliases. That is, if a foreach loops sole content is a %{...} at compile time, grinch. --tom

Re: Idea: minor %hash changes

2000-08-30 Thread Tom Christiansen
>%hash in scalar context should return what scalar(keys(%hash)) >currently does. But %hash->BUCKET_USE() should return what's currently there. And a simple boolean (read: don't care) use shouldn't waste time looking for keys, really, but should be internally optimized to do the current reasonabl

Idea: minor %hash changes

2000-08-30 Thread Nathan Torkington
(I'm going to RFC these if nobody presents any killer complaints about them, it's just that writing RFCs is more work than I want to go through for tiny little changes like these, especially if they turn out to be dumb). %hash in scalar context should return what scalar(keys(%hash)) currently doe