in reply to Re: Rename a Moo constructor from "new" to "run"
in thread Rename a Moo constructor from "new" to "run"
If there is no public I/F to an object, then what's the point of the object? If it is created by new() or run() or whatever and then very next line is the Perl version of "destroy", that code would warrant a #comment to explain that weirdness regardless of how the object was created in the first place - any new() vs run() would be explained also in that #comment. If this object is that simple, why need Moo in the first place? In traditional Perl OO, you can name the new() function whatever you want. Trying to make Moo do something that it doesn't want to do (like replace new() with run()) sounds like a bad idea. I would think either let Moo do it or do it yourself. I haven't used Moo in production, but I guess the idea is to automate and make easier the mechanics of object creation - why override that? If no object is needed in the first place, why have one?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Rename a Moo constructor from "new" to "run"
by Corion (Patriarch) on Mar 28, 2019 at 08:09 UTC |