in reply to RFC: Sub::Attributes -- alter subroutine context behavior with attributes

I'd rather see novoid be an attribute of it's own, rather then an argument to another. It makes sense to use on it's own, it's not logicly a subtype of another contextual thingy.

I'd also rather it be a warning then fatal. warings::warnif("void", "Useless use of $fullydecoratedname in void context"); That'd have parity with what the core does for some builtins. For that matter, you may want to have a :NoScalar and :NoList. (:NoScalar would match sort, see perldiag's "Useless use of sort in scalar context", which I've never actualy seen. I know of no analog for :NoList, but it would seem to be required for parity.) :NoVoid should also skip running of the actual sub.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

  • Comment on Re: RFC: Sub::Attributes -- alter subroutine context behavior with attributes
  • Download Code