Tye, this is excellent, and is exactly the sort of discussion and thoughts I was after. I really appreciate the feedback, even though I'm about to argue against most of it. ;)

I agree that having secret hints is going to result in some bad surprises. Those surprises are going to especially bad when a production system lags behind the development system, and an otherwise correct piece of code suddenly and silently becomes incorrect. That's a really great argument for getting hints out in the open.

However I don't think that users providing their own hints is a good idea. For starters, it means that users need to know much more about the subroutines they're using than they should. I shouldn't need to care about how File::Copy signals failure if I've delegated that task to autodie. I certainly don't want to provide hints every time I invoke the pragma, since that gives me extra chances to get them wrong.

As a lazy consumer, what I do need to know is that when I've delegated something to autodie that it's up to the task. In this sense, I like your idea of using '?' or some other marker to indicate that hints should exist for a given subroutine; I can trigger a compile-time error if they don't.

The other thing I can do is to have autodie insist that all autodying user subroutines have hints, and introduce a marker to indicate that a subroutine is allowed to use the defaults and be hint-free. I really like this, since it makes sure there are no surprises, and it keeps the common syntax both clean and safe. Unfortunately, it also breaks backwards compatibility with existing uses of the module. That's bad.

In any case, a way of signalling that we must know hints for a user-sub is essential for any interface that autodie makes public.

Thanks again for the input, it's hugely appreciated!


In reply to Re^2: RFC: User subroutine hinting interface for autodie (terse, unhidden) by pjf
in thread RFC: User subroutine hinting interface for autodie by pjf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.