Simon Cozens:
>On Sun, May 20, 2001 at 01:09:28AM -0700, Brent Dax wrote:
>> This also reads like English:
>>      Is foo constant?

> Until you realise that in order to actually use it sensibly, you'll
have to say something like
>     if (is $foo constant)
> instead of (as I would prefer)
>     if ($foo is constant)

That depends on how you read an if statement.  Personally, I read them
inside out, so I would read it as:

        Is foo constant?
        If so, do this.

Of course, most people do read them left to right, which does seem a lot
more like natural language.  So maybe I'm just weird.  (Inside out is more
useful for me in general when programming, so I just apply it everywhere.
Think about complicated subscripts or parenthesized expressions and you'll
see why.)

Having infix C<is> be its value in Boolean context would probably not be a
good idea, so I won't suggest it.

An interesting thought just occured to me: are we going to implement tying
through properties?

        my $foo is tied('Tie::SomethingOrOther', *@params);

This kinda fits in with the other properties we're using, where they
(conceptually) don't have any effects until later in the program.  (Of
course, just as C<$fh is chomped> does actually do *something* at that
point, C<$foo is tied> would actually do something, but you don't think of
it as doing so.)  Plus, you can access the underlying object through
$foo.tied (or whatever mechanism it may, but probably won't be, changed to).
Plus, that would mean that we'd freed up the C<tie> keyword.

This brings up another point:  How do we un-property something?  I know that
to undo $foo is true, you can just say $foo is false, but what if you now
want the variables trueness to be just like any other variable's trueness?
Perhaps we should add something to take away a property:

        $foo is true;   #$foo.prop{true}=(whatever)
        .
        .
        .
        $foo isnt true; #delete($foo.prop{true}), at least in Perl 5 terms

If we went with the C<is tied> suggestion I made above, that means we've
just replaced a specific mechanism (untie()) with a more general mechanism
(isnt).  In fact, if you muck with the meaning of not a bit, you could have
it be:

        $foo is not true;

which avoids the adding of C<isnt>, as well as the seemingly inevitable
problem of people putting the apostrophe in.  I think the compiler would be
able to figure out what not means based on context.  Of course, I could be
wrong.  I've never written a real parser before, much less one as magical as
Perl's.

--Brent Dax
[EMAIL PROTECTED]

Fear the sys command on a windows boot disk.  It can ruin your whole day.

Reply via email to