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

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

Thread Previous | Thread Next
From:
Jon Lang
Date:
July 28, 2010 16:39
Subject:
Re: Suggested magic for "a" .. "b"
Message ID:
AANLkTik2zWQngymnffp+03-AuL22hbkyh_BzjDfY6DsH@mail.gmail.com
Aaron Sherman wrote:
>> In smart-match context, "a".."b" includes "aardvark".
>
>
> No one has yet explained to me why that makes sense. The continued use of
> ASCII examples, of course, doesn't help. Does "a" .. "b" include "æther"?
> This is where Germans and Swedes, for example, don't agree, but they're all
> using the same Latin code blocks.

This is definitely something for the Unicode crowd to look into.  But
whatever solution you come up with, please make it compatible with the
notion that "aardvark".."apple" can be used to match any word in the
dictionary that comes between those two words.

> I've never accepted that the range between two strings of identical length
> should include strings of another length. That seems maximally non-intuitive
> (well, I suppose you could always return the last 100 words of Hamlet as an
> iterable IO object if you really wanted to confuse people), and makes string
> and integer ranges far too divergent.

This is why I dislike the notion of the range operator being used to
produce lists: the question of what values you'd get by iterating from
one string value to another is _very_ different from the question of
what string values qualify as being between the two.  The more you use
infix:<..> to produce lists, the more likely you are to conflate lists
with ranges.

-- 
Jonathan "Dataweaver" Lang

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