home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!airgun!se28!rfs
- From: rfs@se28.wg2.waii.com (Robert Starr)
- Newsgroups: comp.lang.perl
- Subject: Re: Perl range operator
- Keywords: range
- Message-ID: <1993Jan4.090026@se28.wg2.waii.com>
- Date: 4 Jan 93 15:00:26 GMT
- References: <1992Dec30.131700@se28.wg2.waii.com> <mcook.725814444@fendahl.dev.cdx.mot.com>
- Sender: news@airgun.wg.waii.com
- Reply-To: starr@wg2.waii.com
- Organization: Western Geophysical
- Lines: 26
- Nntp-Posting-Host: se28.wg2.waii.com
-
- In article <mcook.725814444@fendahl.dev.cdx.mot.com>, mcook@fendahl.dev.cdx.mot.com (Michael Cook) writes:
- |> for i := x..y loop
- |>
- |> the compiler would otherwise have to generate code like this:
- |>
- |> if (x <= y)
- |> for (i = x; i <= y; i++)
- |> ...
- |> else
- |> for (i = x; i >= y; i--)
- |> ...
- |>
- |> Michael.
-
- Which means using a decrementing range (as you used it) in a for loop
- is a no-no (but is fine in a foreach).
-
- I doesn't seem like the range operator behavior ought to be dependent
- upon how it is going to be used. It just seems like (10..1) has an
- expansion which is obvious.
-
- Besides, if Ada requires a reverse, the current Perl expansion *must* be
- incorrect, eh :-)?
-
- --
- | RF Starr (starr@wg2.waii.com) | Western Geophysical | Opinions R mine! |
-