Mark-Jason Dominus (via RT) <perlbug-followup@perl.org> wrote: :The currnt prototype() builtin function returns the prototype of some :other function. For example : : sub bleh ($) { return $_[0] } : print prototype('bleh'); : :This prints '$'. : :But there is no convenient way to modify the prototype of an existing :function. [...] :It seems to me that allowing : : prototype(FUNCTION, '$$;$') : :would be straightforward and would not break any old code. I think the need for this is pretty rare, so it may be that Rafael's suggested Inline/C code is sufficient. Note that you can currently write this, which we should maybe class as a bug: crypt% perl -wle 'sub a ($) { 1 } print prototype(1, \&a)' $ crypt% .. though at least prototype(\&a, '$$;$') would give a: Useless use of reference constructor in void context .. and return undef. I worry also what happens to code calling the function that got compiled before the prototype changed. Not sure if they would cause problems. If we were to consider changing the meaning of core prototype(), we should maybe also consider allowing this usage only when C< no strict 'prototypes' >. HugoThread Previous | Thread Next