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

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

Thread Previous | Thread Next
From:
Darren Duncan
Date:
July 28, 2010 00:38
Subject:
Re: Suggested magic for "a" .. "b"
Message ID:
4C4FDE73.2010100@darrenduncan.net
Michael Zedeler wrote:
> This is exactly why I keep writing posts about Ranges being defunct as 
> they have been specified now. If we accept the premise that Ranges are 
> supposed to define a kind of linear membership specification between two 
> starting points (as in math), it doesn't make sense that the LHS has an 
> additional constraint (having to provide a .succ method). All we should 
> require is that both endpoints supports comparison (that they share a 
> common type with comparison, at least).

Yes, I agree 100%.  All that should be required to construct a range 
"$foo..$bar" is that the endpoints are comparable, meaning "$foo cmp $bar" 
works.  Having a .pred or .succ for $foo|$bar should not be required to define a 
range but only to use that range as a generator. -- Darren Duncan

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