On Tue, Nov 26, 2002 at 08:52:52AM -0600, Garrett Goebel wrote:
: On Mon, 2002-11-25 at 14:25, Michael Lazzaro wrote:
: > (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".
: 
: There is no explicit bool type.
: 
: Larry Wall wrote:
: > 
: > Please don't think of C<bit> as a boolean type.  There is
: > no boolean type in Perl, only a boolean context.  Or looking
: > at it from the other direction, *every* type is a boolean
: > type.
: 
: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=Pine.LNX.4.44.021031
: 1952540.18773-100000%40london.wall.org

Um.  I modified that statement later in the same thread:

    
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=Pine.LNX.4.44.0210311952540.18773-100000%40london.wall.org&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3DPine.LNX.4.44.0210311952540.18773-100000%2540london.wall.org

I don't think there *has* to be a bool type.  Certainly we could get
by with:

    my bit $x = ?(0 but true);

Though it would look a little odd to write:

    my bit $x = true(0 but true);

Note that the "true" property is not the same as the "true" function.
This tells me that properties may need their own namespace distinct
from either subs or classes.  (We've talked about defining properties
as subs or classes, but either way is problematic.  If we have a
C<true> class we can't parse a C<true> unary operator correctly.)

Hmm, we may have the same problem with all classes, if the unary
operator is supposed to be a type cast.  We can't have "int"
meaning both

    my $class = int;
    my $integer = int $number;

unless we either require parens on typecasts, or parse class names as
typecasts for which no argument could be found.  The latter approach
is more appealing than requiring parens, but we might have difficulty
telling

    new Int 3

from

    new Int: 3

Hmm.

Larry

Reply via email to