develooper Front page | perl.perl6.language | Postings from February 2004

Re: The Sort Problem: a definitive ruling

Thread Previous | Thread Next
From:
Larry Wall
Date:
February 19, 2004 21:16
Subject:
Re: The Sort Problem: a definitive ruling
Message ID:
20040220051546.GA16733@wall.org
On Fri, Feb 20, 2004 at 02:47:55PM +1100, Damian Conway wrote:
: Yep. Inside the body of C<sort> you'd access them as:
: 
: 	$by.trait{descending}
: 	$by.trait{insensitive}
: 
: (unless Larry's changed the trait accessor syntax since last I looked).

Well, if traits are just compile-time properties, and properties
are just mixed-in roles (usually enums), then it's more likely that
something like:

	$by.Direction == descending
	$by.Case == insensitive

would be the incantation.  Or maybe if enums auto-booleanize, then
you could say

	$by.Direction::descending
	$by.Case::insensitive

And then

	$by.descending
	$by.insensitive

might be allowed as abbreviations when unambiguous.  Or maybe we
require matching:

	$by ~~ descending
	$by ~~ insensitive

But there is no such thing as a "true" property or "false" property.
There's a Boolean role that can have the value true or false.  Traits
are mixed in to declared objects at compile time, and can do weird
things to such objects at mixin time.

Likewise there's no such thing as a "descending" property.  There's
a Direction property which defaults to "ascending".  And a Case property
that defaults to "sensitive".

To do otherwise is to set ourselves up for objects that can be both
true and false simultaneously.  Only junctions should be allowed
to do that...

Larry

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