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

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

Thread Previous | Thread Next
From:
Mark J. Reed
Date:
July 20, 2010 20:53
Subject:
Re: Suggested magic for "a" .. "b"
Message ID:
AANLkTikqb-iEyFeHIdjZ9BWsJ4TZWWuPWFGaS05TSugN@mail.gmail.com
On Tue, Jul 20, 2010 at 11:28 PM, Aaron Sherman <ajs@ajs.com> wrote:
> So, what's the intention of the range operator, then?

... is a generator that lazily enumerates a series.  .. is a
constructor for a Range object.  They're two different things, with
different behaviors.  In particular, consider that pi ~~ 0..4 is true,
 because pi is within the range; but pi ~~ 0...4 is false, because pi
is not one of the generated elements.

> I guess you could write:
>
>  ア, イ, ウ, エ, オ, カ ... ヂ,ツ ...モ,ヤ, ユ, ヨ ... ロ, ワ ... ヴ (add quotes to taste)
>
> But that seems quite a bit more painful than:

Perhaps the syllabic kana could be the "integer" analogs, and what you
get when you iterate over the range using ..., while the modifier kana
would not be generated by the series  ア ... ヴ but would be considered
in the range  ア .. ヴ?  I wouldn't object to such script-specific
behavior, though perhaps it doesn't belong in core.

-- 
Mark J. Reed <markjreed@gmail.com>

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