On Fri, Oct 12, 2018 at 06:47:40AM -0400, Curt Tilmes wrote:
: Adding it gives more information to the consumers of that routine,
: the people reading it, the compiler optimizing use of the routine,
: and the runtime execution which will validate the return and throw an
: exception for you if it is wrong.  (There is a tiny, tiny bit of runtime
: overtime to do that check.  Optimization could easily offset or overwhelm
: that overhead.)

Note that in the specific case of returning Nil or some other literal
value, there is no runtime check at all, and the last statement of
the routine is evaluated in sink context because its value is known to
be unwanted.  In fact, if you *try* to return something in addition to
what --> already returns, it'll question your sanity:

    > p6 'sub troo ( --> True ) { return False }'
    ===SORRY!=== Error while compiling -e
    No return arguments allowed when return value Bool::True is already 
specified in the signature


Reply via email to