home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7659 < prev    next >
Encoding:
Internet Message Format  |  1993-01-04  |  1.2 KB

  1. Path: sparky!uunet!airgun!se28!rfs
  2. From: rfs@se28.wg2.waii.com (Robert Starr)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Perl range operator
  5. Keywords: range
  6. Message-ID: <1993Jan4.090026@se28.wg2.waii.com>
  7. Date: 4 Jan 93 15:00:26 GMT
  8. References: <1992Dec30.131700@se28.wg2.waii.com> <mcook.725814444@fendahl.dev.cdx.mot.com>
  9. Sender: news@airgun.wg.waii.com
  10. Reply-To: starr@wg2.waii.com
  11. Organization: Western Geophysical
  12. Lines: 26
  13. Nntp-Posting-Host: se28.wg2.waii.com
  14.  
  15. In article <mcook.725814444@fendahl.dev.cdx.mot.com>, mcook@fendahl.dev.cdx.mot.com (Michael Cook) writes:
  16. |>    for i := x..y loop
  17. |> 
  18. |> the compiler would otherwise have to generate code like this:
  19. |> 
  20. |>    if (x <= y)
  21. |>       for (i = x; i <= y; i++)
  22. |>          ...
  23. |>    else
  24. |>       for (i = x; i >= y; i--)
  25. |>          ...
  26. |> 
  27. |> Michael.
  28.  
  29. Which means using a decrementing range (as you used it) in a for loop
  30. is a no-no (but is fine in a foreach).
  31.  
  32. I doesn't seem like the range operator behavior ought to be dependent
  33. upon how it is going to be used.  It just seems like (10..1) has an
  34. expansion which is obvious.
  35.  
  36. Besides, if Ada requires a reverse, the current Perl expansion *must* be
  37. incorrect, eh :-)?
  38.  
  39. -- 
  40. | RF Starr (starr@wg2.waii.com) | Western Geophysical | Opinions R mine! |
  41.