On 5/29/07, Larry Wall <[EMAIL PROTECTED]> wrote:
On Tue, May 29, 2007 at 04:43:20PM -0400, Chas Owens wrote:
: Just an odd corner case, but
:    "foo" x -*
: should return an empty string and
:    "foo" xx -*
: should return an empty list, right?

I'm doubt &prefix:<->:(Whatever) is defined at all, so that's probably
a run-time failure unless someone defines the appropriate multi.
And if the - fails it never even gets to the x or xx.  The * token
doesn't mean infinity.  It means that the operator you feed it to
has to figure out what it means.  Some operators interpret * to mean
infinity.  But infix:<-> interprets a * on the left to mean the end
of the current subscript range.  And the range operator interprets *
to mean either negative or positive infinity depending on whether
it's on the left or the right.  We don't require (or even allow)
people to say -*..* as it currently stands.

Larry

Okay, obviously I have more synopsis to read, but currently Pugs says:
pugs> my $posinf = *
Inf
pugs> my $neginf = -*
-Inf

which made me think * is Inf in scalar context.  Is this a bug in Pugs then?

Is Inf the canonical way of spelling the literal "infinity"?

I am patching Pugs' x and xx operators to handle infinity now.  The
behavior after the patch is
pugs> "a" x 5
"aaaaa"
pugs> "a" x 0
""
pugs> "a" x -5
""
pugs> "a" x Inf
Internal error while running expression:
Infinite replications would exahust memory
pugs> "a" x -Inf
""

Besides fixing the spelling error on exhaust and making it a real die
instead of an internal error (which I have yet to figure out how to
do), does this match up with your expectations for the replication
operators?

Reply via email to