> (2) The behavior of an explicit bool type, _if_ one exists, that stores
> "truth", not "value".  Such that C<my bool $y = (0 but true)> stores
> true, not 0, and does so in "the most efficient way".

I think before we can answer this question, we have to know how to extract
truth.

my int $x = (0 but true);

Now, how do you get the bool from $x.
$x.getBool()
$x.isTrue()
if( $x ) {
}

See the section on typecasting for more info...

> (3) Context.  How to determine it, how to force it.  Hypothesis: There
> is a one-to-one relationship between Type and Context, such that there
> is a context that matches every type, and a type that matches every
> context (except void).

This is not true in Perl5 as you only have scalar/list/void context.  I can
see this changing or remaining the same depending on how well your lunch
digested:

my int $x = 2.2; # this either 1.) casts 2.2 to int context
                    #   or          2.) 2.2 remains in scalar context, $x's
assignment operator does a trunc

I personally prefer 2.  I would rather keep things simple and just allow
scalar/list/void context...perhaps also array and hash context now.

> (4) Typecasting.  How int <--> num, num <--> str, str <--> bool, etc.
> Generic typecasting rules: how to define user classes that can typecast
> to/from str, int, bool, etc.  This gets into Perl6 OO, but we may need
> to request some preliminary decisions before then, because the
> implications are substantial.

Perl 5 did not have typecasts...probably for good reason.  The quip in the
camel book says that no one likes to be typecast, anyway.  I would rather
not have typecasts in Perl6 if we can get by without them.  However, runtime
properties give me problems with this

my int $x = (0 but true);

if( $x or false ) {
}
Does the or evaluate to true or false?  What if we want to compare the
numeric portion of $x.
if( int($x) or false ) {
}

Now is it false?

In the general case, I can't really see a need for typecasts.  It is only
when paired with
runtime properties that they have some benefit.  However, if there were ways
to easily
access the value vs. the property, then we could eliminate them completely.

Tanton

Reply via email to