On Mon, Sep 25, 2000 at 02:17:38PM -0700, Nathan Wiger wrote:
> import Foo;
You're beginning to blur your own fine line here. import is a class method
call using indirect object syntax.
> But notice the disconnect here:
>
> package Foo;
> use base 'Bar';
>
> Seems almost that:
>
> package 'Foo';
> use base 'Bar';
>
> Would be more consistent.
Using 'Foo' with package implies $foo, or foo(), or "f" . "oo", or any
scalar, would work.
This whole idea reminds me of the quote:
A foolish consistency is the hobgoblin of little minds.
-- Ralph Waldo Emerson
Not to say you have a little mind, but is this a foolish consistency?
Most of Perl's bareword handling is what I mean, with the exception of class
method calls, which we already have a proposal for fixing. You are also
already proposing we keep certain exceptions to your 'no barewords' rule.
So what's left?
print STDERR "Foo";
We have a proposal to turn STDERR into $STDERR, and it looks likely it'll go
through.
$time = time;
print;
If use strict 'subs' is in effect you're guaranteed these are subroutine
calls, or compile-time errors. If it isn't you get a nice little warning.
Perhaps the stringification should be removed entirely, and the syntax
always be a subroutine call.
Class->foo()
shift->bar()
new Foo;
Class method calls, regardless of the existence of a subroutine in scope,
under the new proposal. I'm not sure of the last one, but it seems natural:
force the user to disambiguate with parens if they truly meant Foo() to be a
subroutine call.
stat->{'mode'}
No ambiguity here.
use Foo;
require Foo;
package Foo;
%foo = (bar => "baz");
All exceptions to the rule.
$foo{bar}
There's one you didn't mention. Currently it's unambiguous, you have to use
$foo{+bar} or $foo{bar()} to get a subroutine call.
Did I miss anything?
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--