in reply to Re^5: Infinity and Inf? (MAX_INT)
in thread Infinity and Inf?
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.
|
|---|