Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help choosing a Module name

25 views
Skip to first unread message

Jed Lund

unread,
Oct 5, 2012, 3:04:59 PM10/5/12
to mo...@perl.org
All,

I am looking for some assistance choosing a good module name for a class
that I would like to build. Essentially it would perform a similar
function to Moose::Util 'with_traits' or MooseX::ClassCompositor. The
major difference in my offering would have a different user interface. I
am thinking of the following possibilities.

MooseX::Util::ClassBuilder

MooseX::ClassBuilder

MooseX::Shiras::ClassBuilder

I noticed that many MooseX modules have Util in the third position but
there doesn't seem to be a MooseX::Util branch of the namespace yet?

Any suggestions are welcome.

JANDREW

Jed

Stevan Little

unread,
Oct 5, 2012, 7:22:10 PM10/5/12
to Jed Lund, mo...@perl.org
Jed,

Might be helpful if you pointed us at some code.

Personally I am not a fan of MooseX::Util as a namespace, the idea behind MooseX:: is that it provides extension to Moose itself, and MooseX::Util reads to me as "utilities to help build extensions of Moose", which is not what your module sounds like.

- Stevan

Jed Lund

unread,
Oct 7, 2012, 10:51:26 PM10/7/12
to Stevan Little, mo...@perl.org
Stevan,

Thank you for the reply.

I have posted a prospectus of code on PrePan @

http://prepan.org/module/429En4oFep

And the actual first pass on github @

https://github.com/jandrew/MooseX-Util-ClassBuilder

The name is a default just for posting code.

Best Regards,

Jed

Dave Rolsky

unread,
Oct 7, 2012, 11:04:56 PM10/7/12
to Jed Lund, mo...@perl.org
On Sun, 7 Oct 2012, Jed Lund wrote:

> I have posted a prospectus of code on PrePan @
>
> http://prepan.org/module/429En4oFep

How is this any different than what Moose::Meta::Class->create()
(and create_anon_class) provide?

All your code does is reimplement that, AFAICT.


-dave

/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/

Jed Lund

unread,
Oct 8, 2012, 11:29:19 AM10/8/12
to mo...@perl.org
Dave,

I agree the differences are minor. However, In my mind the differences are
valuable if possibly more style based.

I wrap two changes around Moose::Meta::Class->create in my proposal. I
accept named hash value pairs for everything including a new package name
where ->class() expects the new name as the first argument. Second I have
an instance creation method that leverages the class creation method. I
just noticed that it is not included on the PrePAN synopsis These two
changes allow me to do two things. First since all arguments are named
arguments they can either be omitted or provided with no code failure.
Meaning I can create an anonymous class with the same function as a named
class by just omitting the key/value pair for the name. Second, the class
function is set up to pass through instance arguments that are composed as
a hash without touching them. This makes it possible to bundle the
necessary arguments for an instance with the arguments for a completely new
class and create the instance without using the following syntax.

my $instance = Moose::Meta::Class->create(
'New::Class',
superclasses => ['Super::Class'],
roles => ['Does::Something'],
)->meta->name->new( %args );

I understand that both issues are style based and are not intended to
reflect on Moose or its excellent implementation, but I find the previous
syntax a bit clunky and it occurs a fair amount in code I am writing now.
As a consequence I am looking for an out of the way namespace to place a
class I can use to modify the instance implementation syntax to a 'method(
%args )' style.

Best Regards,

Jed


On Sun, Oct 7, 2012 at 8:04 PM, Dave Rolsky <aut...@urth.org> wrote:

> On Sun, 7 Oct 2012, Jed Lund wrote:
>
> I have posted a prospectus of code on PrePan @
>>
>> http://prepan.org/module/**429En4oFep<http://prepan.org/module/429En4oFep>
>>
>
> How is this any different than what Moose::Meta::Class->create() (and
> create_anon_class) provide?
>
> All your code does is reimplement that, AFAICT.
>
>
> -dave
>
> /*============================**==============================**==
> http://VegGuide.org http://blog.urth.org
> Your guide to all that's veg House Absolute(ly Pointless)
> ==============================**==============================***/
>

Dave Rolsky

unread,
Oct 8, 2012, 11:49:44 AM10/8/12
to mo...@perl.org
On Mon, 8 Oct 2012, Jed Lund wrote:

> I wrap two changes around Moose::Meta::Class->create in my proposal. I
> accept named hash value pairs for everything including a new package name
> where ->class() expects the new name as the first argument.

Actually, Moose already accepts key/value pairs for this method, but this
is documented (this thing with multiple calling styles is something I
really hate in the Moose core).

Most (but not all) methods of the ->method( $name, %args ) style also work
with ->method( name => $name, %args ). Substitute the "name" key for
"package" or whatever is appropriate.

Anyway, calling this MooseX::Util::ClassBuilder seems kind of weird since
Moose already has plenty of class building support.

It's more like MooseX::ShortCut::BuildClass or something.


-dave

/*============================================================
http://VegGuide.org http://blog.urth.org
Your guide to all that's veg House Absolute(ly Pointless)
============================================================*/

Jed Lund

unread,
Oct 8, 2012, 12:05:40 PM10/8/12
to Dave Rolsky, mo...@perl.org
Dave,

I must have overlooked the "name => $name," option in the documentation.
Thank you for pointing it out.

I also appreciate the the suggestion for a module namespace. I am happy to
acknowledge that what I am attempting is a shortcut only.

Best Regards,

Jed

On Mon, Oct 8, 2012 at 8:49 AM, Dave Rolsky <aut...@urth.org> wrote:

> On Mon, 8 Oct 2012, Jed Lund wrote:
>
> I wrap two changes around Moose::Meta::Class->create in my proposal. I
>> accept named hash value pairs for everything including a new package name
>> where ->class() expects the new name as the first argument.
>>
>
> Actually, Moose already accepts key/value pairs for this method, but this
> is documented (this thing with multiple calling styles is something I
> really hate in the Moose core).
>
> Most (but not all) methods of the ->method( $name, %args ) style also work
> with ->method( name => $name, %args ). Substitute the "name" key for
> "package" or whatever is appropriate.
>
> Anyway, calling this MooseX::Util::ClassBuilder seems kind of weird since
> Moose already has plenty of class building support.
>
> It's more like MooseX::ShortCut::BuildClass or something.
>
>
>
> -dave
>
> /*============================**==============================**==
> http://VegGuide.org http://blog.urth.org
> Your guide to all that's veg House Absolute(ly Pointless)
> ==============================**==============================***/
>
0 new messages