in reply to Re: Re: Re: Is "ref $date eq 'ARRAY'" wrong?
in thread Is "ref $date eq 'ARRAY'" wrong?

I mean, are you suggesting that someone should say that just to be depantic (which I'll understand) or that it is actually reasonable?

It is much more reasonable to make you, the user of Module::X, decide explicitly that it should mess with the internals of an object of Some::Random::Class rather than expect Module::X to just go ahead and do it because Some::Random::Class happens to be implemented using the right type of reference as its blessed thingy.

The author of Module::X should be kind enough to respect that, if ref() reports $parameter to be blessed into Some::Random::Class, then its implementation is off limits. A blessed thingy is a blessed thingy regardless of what type of reference it happens to be. If you want to take the responsibility of relying on Some::Random::Class's implementation, then you can do it... by reblessing it.

If you want targets painted on your boots, do it yourself; don't expect someone else to do it for you.

P.S. If you write modules that would make use of such a misfeature in Module::X, you are almost certainly making poor design decisions.

P.P.S. Setting aside the flagrant disregard of the principles of encapsulation that it would entail, why should Module::X be riddled with sticky parameter checking that would probably only be useful in rare cases anyway? I'm not a fan of bloat. The additional test cases alone would be reason enough to avoid it. As I said elsewhere in this thread, keeping things simple is a sound approach. This suggestion is neither simple nor sound.

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Re: Re: Re: Is "ref $date eq 'ARRAY'" wrong?