* On Fri, Oct 16 2009, O. STeffen BEYer wrote:
> Any hints on all that?

Wow, a lot of people CC'd on that message.  That is probably Considered
Annoying to the people you sent it directly to.

Anyway, optional requirements probably aren't the *worst idea ever
conceived*, but they are close.  When your module depends on optional
modules, my module can't just say, "requires Foo::Bar", it has to say
"requires Foo::Bar" and whatever modules one would need to make your
optional features work.  This may change from version to version, making
it impossible to ship a reliable module that depends on yours.

It is also a problem when communicating with others; when I ask someone
to "try Foo::Bar", I now need to tell them exactly which combination of
optional modules to install also.  If I can remember.

Finally, detecting which features to enable at runtime can be flaky.
Imagine you have a module that enables an optional feature when
Foo::Quux is installed.  I don't want that feature when I install the
module, so I skip installing the prereq.  For a while, your module works
fine.  Some time in the future, I install Foo::Quux to satisfy the
dependencies for Gorchify::It, and suddenly, your module stops working
due to auto-detecting Foo::Quux, enabling an optional feature, and then
not working the same way anymore.  Very bad.  Modules should not work
differently based on whether or not other random modules happen to be in
@INC.

The solution is to make each optional feature a separate distribution;
then it's easy to depend on the optional feature, easy to remove if you
don't want it, and easy to communicate to others.

Also, I can tell you one thing that nobody wants to do while installing
CPAN modules, and that's answer questions.  I want to say "cpan Foo" and
go away and not monitor the terminal it's running in to see if it's
asking me questions like "Do you want to install the module that you
requested to install? [y]".  No... I don't want to install the module I
just invoked "cpan -i" on... thanks for asking...

To summarize: Optional requirements considered harmful.

Regards,
Jonathan Rockway

--
print just => another => perl => hacker => if $,=$"

Reply via email to