I question these design decisions forcing the user to care about such implementation details.

Which users are those? Very few will ever needed to iterate over numbers greater than 2,147,483,648, and very few will ever need to iterate over numbers greater than 9,223,372,036,854,775,807 (64-bit builds).

It's a compromise between resources and utility. Only using integers internally is faster, requires less memory and requires less code than supporting both integers and floats.

the cleanest syntax would be allowing to use Inf

If we pretend that for to take a lazy list, you'll complain that it doesn't make sense for map not to, from a higher language perspective.

Mind you, I think for ($x..Inf) has merit.

for(..){} can't iterate thru the same spectrum like a while($x++){ } can do.

If you think the range op has a seemingly arbitrary limit, you should see ++'s! For example, 1e16 to 1e16 is ok, but 1e16 to 1e16+1 isn't.

$ perl -E'for (my $_ = 1e16; ; ++$_) { say }' 1e16 1e16 1e16 1e16 ...

Update: Mixed $x and $_ in last snippet. Fixed.


In reply to Re^6: Infinity and Inf? (MAX_INT) by ikegami
in thread Infinity and Inf? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.