develooper Front page | perl.perl6.language | Postings from July 2010

Re: Suggested magic for "a" .. "b"

Thread Previous | Thread Next
From:
Carl Mäsak
Date:
July 16, 2010 12:49
Subject:
Re: Suggested magic for "a" .. "b"
Message ID:
AANLkTikyFVM_xWhF709vWo4UP4M4RJg8QgotKXTa2E8x@mail.gmail.com
Aaron (>):
> [...]
>
> Many useful results from this suggested change:
>
> "C" .. "A" = <C B A> (Rakudo: <>)

Regardless of the other traits of your proposed semantics, I think
permitting reversed ranges such as the one above would be a mistake.

Rakudo gives the empty list for ranges whose lhs exceeds (fsvo
"exceeds") its rhs, because that's the way ranges work in Perl. The
reason ranges work that way in Perl (in my understanding) is that it's
the less surprising behavior when the endpoints are determined at
runtime.

For explicitly specifying a reverse list of characters, there's still
`reverse "A" .. "C"`, which is not only a straightforward idiom and
huffmanized about right, but also good documentation for the reader.

// Carl

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About