develooper Front page | perl.perl5.porters | Postings from November 2014

[perl #123092] Sub inlining inconsistencies

Thread Previous
Father Chrysostomos via RT
November 2, 2014 13:59
[perl #123092] Sub inlining inconsistencies
Message ID:
On Sun Nov 02 00:30:58 2014, demerphq wrote:
> Seems to me the problem here is that the () prototype does too much, in
> that it is used to mark a sub as constant, and to mark as sub as
> argumentless. Since changing that at all will break lots of stuff, I think
> the safest solution is to leave it alone, possibly in the long term
> deprecating it, and add two new prototype's which do the two jobs
> separately, once they have been in the wild for a while you can deprecate
> and then remove the () prototype.

I’m opposed to that approach, because there should be no need for sensible code to change from () to anything else if I tread carefully enough.

The cases I came up with are from reading the code that I had trouble making sense of at first.  It’s unlikely they occur in the wild, and if they do, I am probably fixing buggy code.

> With these two behaviours separated there is no need for code detection,
> any sub with a "C" prototye would be executed once at compile time,

That sounds like the :const prototype that Ævar Arnfjörð Bjarmason proposed.

> and
> then its result used in place of any call to it in the code. (Which is how
> this should have been done in the first place.)
> IOW, I think you are trying to solve this problem the wrong way. Don't
> bother fixing it, make it unnecessary to do at all.
> Yves


Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About