pg has asked for the wisdom of the Perl Monks concerning the following question:

According to the doc of bigint, it claims that all operators are overloaded:

"All operators (including basic math operations) are overloaded."

But this gives error:

use strict; use warnings; use bigint; print 2 ** 31 -1; for (1 .. 2 ** 31 - 1) { print "."; }
Range iterator outside integer range at math1.pl line 6.

(This is 5.8.4)

Replies are listed 'Best First'.
Re: bigint does bot overload range operator
by sk (Curate) on Oct 02, 2005 at 05:41 UTC
    I don't see a range opertator in this output -

    #!/usr/bin/perl use strict; use warnings; use overload; print +("$_ : ", $overload::ops{$_},$/) for (keys %overload::ops);

    Update: Used a colon in the print instead of a "=" to separate key/value.

    3way_comparison : <=> cmp dereferencing : ${} @{} %{} &{} *{} str_comparison : lt le gt ge eq ne with_assign : + - * / % ** << >> x . binary : & | ^ iterators : <> unary : neg ! ~ special : nomethod fallback = num_comparison : < <= > >= == != assign : += -= *= /= %= **= <<= >>= x= .= mutators : ++ -- func : atan2 cos sin exp abs log sqrt int conversion : bool "" 0+

Re: bigint does bot overload range operator
by rir (Vicar) on Oct 02, 2005 at 04:19 UTC
    .. is not overloadable.

    Be well,
    rir

      .. is not overloadable.
      Is this because the overload moudule doesn't allow for it, or because it's truly not overloadable? I'm honetsly curious...

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

      That was what I guessed, but I had the same thought as thor, which to me is more important.

      There must be some technical difficulty underneath, that made them to choose a easy way out and disable the ability to overload range operator. But I am on the same page as thor, logically there is no ground for that, and hopefully this will be opened up in the future.