What always annoys me about Perl is that you can't create an alias for a package elegantly.

I would imagine something like this, for example:

use Very::Long::Package::Name as ShortName;

#perl

There is the following utility on CPAN, for example.

use aliased 'Very::Long::Package::Name' => 'Short';

Firstly, it's not very nice because you have to fiddle around with strings, and secondly,
something like this should be in core Perl. Because then IDEs could perhaps adapt to it or support this feature. I think that would be a very important point.
#perl

Man. Of course, you can also do the following, but it's not really nice either.

BEGIN {
*Short::Name:: = *Very::Long::Package::Name::;
}

#perl

#Rakulang actually does it the way it should be similar done in #perl.

use Very::Long::Module::Name as Short;

Or

use Math::Trig :sin(:as<s>), :cos(:as<c>);

use Some::Module
:foo(:as<f>),
:bar(:as<b>);

Follow

@leobm Python and C++, too:
py: import SomeLongModule as slm
c++: namespace slm = someLib::somethingLong::module

I tend to curse Python and C++ sometimes. Weirdly good to read that others struggle too - or even more ^^

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.