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

[perl #123092] Sub inlining inconsistencies

Thread Previous
From:
Father Chrysostomos via RT
Date:
November 2, 2014 13:59
Subject:
[perl #123092] Sub inlining inconsistencies
Message ID:
rt-4.0.18-18685-1414936767-1644.123092-15-0@perl.org
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
https://rt.perl.org/Ticket/Display.html?id=123092

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About