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

Re: [perl #76238] Bool.pick always returns false.

Thread Next
From:
Steven Lembark
Date:
July 1, 2010 01:13
Subject:
Re: [perl #76238] Bool.pick always returns false.
Message ID:
20100630181852.54c6858blembark@wrkhors.com@wrkhors.com
On Mon, 28 Jun 2010 08:13:21 -0700
"Patrick R. Michaud via RT" <perl6-bugs-followup@perl.org> wrote:
 
> For a wide variety of reasons, Rakudo currently implements Bool as a
> fundamental type rather than an enumeration.  As such, Bool.pick is
> acting the same as if one had written "Int.pick" or "Num.pick" -- it's
> treating the invocant as a list of one element and then returning the
> type object directly.  And Bool as a type object always returns false
> because it is undefined.

Q: Why would the object type be false?

I would have thought that 

    Bool.pick and print for ^100

turning into 

    'Bool' and print for ^100;

would print all of the values, rather than printing
none of them (admittedly given only one day of Damian's
P6 class this assumption may be waaaay off).

 
> For now, the workaround is to do (False,True).pick until we can properly
> implement .pick on enumerations, and figure out how to turn Bool into
> one (or convince the specification that Bool is not really an
> enumeration :-).

Actually ^2.pick  works nicely also, just seemed
odd that Bool.pick didn't.

thanx

-- 
Steven Lembark                                            85-09 90th St.
Workhorse Computing                                 Woodhaven, NY, 11421
lembark@wrkhors.com                                      +1 888 359 3508

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