At Mon, 23 Aug 2004 15:51:00 -0400,
[EMAIL PROTECTED] (Aaron Sherman) wrote:
>
> On Mon, 2004-08-23 at 15:19, Paul Seamons wrote:
> > > So, I was wondering about a synonym, like:
> > >
> > > uses Some::Module::That::Defines::A::Class $foo;
> >
> > Well if the long name is the problem:
> >
> > use Some::Module::That::Defines::A::Class as Foo;
>
> No, like I said: this is not golf. I'm trying to remove an element of
> redundancy that I think obscures the meaning of a set of statements.
>
> Saying,
>
> use reallylongnameforamodulethathassomeclass as Foo;
> our Foo $bar := .new;
>
> Still has the same redundancy, it's just been hidden a bit. If
> "use/instantiate" is a common practice for certain kinds of library,
> then I think we should have a mechanism to perform that pair as a single
> step.
How about making "use" a list operator returning the module's return
value (== its last statement?)? Then you could do something like
my $x = (use Some::Module::That::Defines::A::Class).new("blah");
This leaves a bad taste in my mouth -- I think importing a module and
instantiating its main class should remain separate -- but this looks
like a painless way to get what you want without a separate function
or keyword.
/s