David Wheeler [mailto:david@;wheeler.net] wrote:

> The problem with this is that you have explicitly introduced true and 
> false into the language, and have therefore destroyed the utility of 
> context:
> 
>    my boolean $bool = 0; # False.
>    my $foo = '';         # False context.
>    if ($foo eq $bool) {
>        # Oops!
>    }

If I am not mistaken, we already have explicitly introduced
true and false into the language:

  my $bar = 0 but true;
  my $bas = 0 but false;

A boolean type is therefore not quite as big a stretch as
you imply.

But we still have to deal with the expression issue:

  if ($bar eq $bas) {} # true
  if (?$bar eq ?$bas) {} # false

  my $bool = true;
  if ($bool eq $bar) {} # ???

Presumably, there exist rules for implicit casting when
comparing objects of different types. If we have a rule
that says that "if either operand is a boolean, then both
are compared as booleans", then things would work just
fine (except the the things I haven't considered ;-)).

The question of "what is C<true>" is really an implementation
issue. It could be a superposition of all true values; or it
could just be a predefined value, that has some special magic
associated with it. Perhaps its just a keyword, whose context
determines whether it is a value, or a property.


Dave.

Reply via email to