develooper Front page | perl.modules | Postings from June 2018

Rationale for using Dot as a top level namespace

Yang Bo
June 1, 2018 09:40
Rationale for using Dot as a top level namespace
Message ID:
I just did some reading on PAUSE and found out that using top level
namespace is considered bad and impolite, I don't know whether that's
the reason that indexing failed for my module [1], but I think it indeed
qualifies as a top level package.

First, it's an object system, just like Moose, but it's really different,
the traditional Perl 5 OO mechanism is bypassed completely, and you
don't call a method using $obj->method, but $obj->{method}, and a class
is not a package but a subroutine, and it never creates an object but
only modifies it. So Dot as an object system behaves differently and it
would cause confusion if it doesn't have its own top level namespace,
if a class resides in the Dot namespace you would immediately know
how to construct an object from it and how to call the methods from
the object.

Also, Dot is designed to be a base class from which every Dot object
inherits, so it's indeed at the top level of the hierarchy and just
reflects how things actually are.

I hope this justifies using Dot as toplevel namespace.

Please tell me what else I need to do or did wrong, this is really
important for me. Thanks in advance.

Yang Bo.

[1] Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About