----- Original Message -----
From: "PRADEEP GOEL" <[EMAIL PROTECTED]>
To: "Paul Johnson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 6:27 PM
Subject: Re: a Bug in PERL


>
> ----- Original Message -----
> From: "Paul Johnson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, December 03, 2002 5:13 PM
> Subject: Re: a Bug in PERL
>
>
I am really sorry if I am appearing  offensive ,
I never meant to be  .
In perlsyn documen it does says " Don't do that " else it will get "
confused"
& quite below it says a C programmer does this - while same can be written
in perl as this
( a shorter way ) - Now the "FACT" - you wana remove / delete the element -
go the "C" way
else learn foreach for shorter way -  so learn both .
 -  but it seem to be a  deficiency on it's part
that every such thing , which you expect as a "common sense" gets explained
as a mistake in
documentation - does it means only after reading the documentation line by
line you should start programmimg.
 Or it happens , (what happens with me) you write a whole program using
foreach ,
& after a lot of search , come to know "don't do that " & now replace that
with while or for loops
like in "C".
is it true that  more flexibility in a language => more confused the
language will get

> >
> > >> If you look in perlsyn, under the heading "Foreach Loops", you will
> > >> see:
> > >>
> > >>   If any part of LIST is an array, C<foreach> will get very confused
> > >> if you add or remove elements within the loop body, for example with
> > >> C<splice>.   So don't do that.
> > > llllllllllllllllllll -  whether C<foreach>  will get confused or not ,
> > > but i have already,
> > > since this is a common procedure , in any programming language to
remove
> > > /add elements
> > > of an array in a loop .
> >
> > Yes, but not the array over which you are iterating.
> $$$$$$$$$ in NO case a language changes its behaviour for an array with 1
> element
> & the same code with array of 2 or more elements ( what the PERL is doing
> here )
> it does pops out if last element also happens to be the only element of
> array.
> >
> > I am unclear as to what your posted code should do.  I can think of a
> > number of interpretations.  Perl says that this behaviour is undefined.
> > This means that it doesn't need to give a (possibly arbitrary)
> > interpretation and allows the implementation the flexibility to be coded
> > for speed.
> >
> > >  & also that any programming language must follow some sure
mathematical
> > > rules & should not get confused .
> >
> > The rule is "don't do that".  Most languages have rules like that for
> > various situations.  In C, for example, a statement such as i = i++ is
> > unedefined behaviour.  The compiler may do what it will with that
> > statement and the whole program.
> >
> $$$$$$$$$certainly a prog language is implemented by a
compiler/interpreter
> & they follow the mathematical rules ,
> i =i++ will too have the same behaviour for two differnt two same kind of
> variales( may be arrays)
> by same compiler
>
> BRIEF ///////////////////////////////////////////
> I don't think any language defines two different behaviour anywhere at any
> place for
> either two arrays with different no of elements nor for any two variables
of
> same type
> at same place,same compiler  ( say continuous in a program)
> That's why it seems to be a  BUG
> > --
> > Paul Johnson - [EMAIL PROTECTED]
> > http://www.pjcj.net
> >
> >
> >
> >
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to