* Michael G Schwern <[EMAIL PROTECTED]> [05/18/2001 12:32]:
> Let me see if I understand this...
> 
>   $Foo is true;
> 
>   # Meanwhile, in another part of the city...
> 
>   $Foo = 0;
>   print "My spider sense is tingling" if $Foo;
> 
> Does that print or not?

Maybe there are two different features being conflated here. First, we
have "is", which is really for assigning permanent properties:

   my $PI is constant = '3.1415927';
   my $int is integer;
   $int = 5.4;          # error, or something...

So, those make sense, and we'd want them to remain through assignment.
However, the "true", "error", "false", etc, really are *temporary*
conditions.  Maybe we need a separate keyword - "as" - for this:

   return $zero as true;
   return $fh as error("Internal Blah Blah Blah: $!");

For stuff declared with this "as" keyword, it would last until next
assignment or other value change. That is, these are value dependent and
designed to pass extra information along. By definition, though, when
the value changes we'll want these properties to change as well.

So, Schwern's example would be work as follows:

   $Foo is true;
   $Foo = 0;
   print "Stuff" if $Foo;       # would not print - "is" assigns a
                                # permanent "true" property

   $Foo as true = "";
   $Foo = 0;
   print "Stuff" if $Foo;       # would print - "as" is reset by
                                # value assignment since is temporary

-N8

Reply via email to