develooper Front page | perl.perl5.porters | Postings from December 2008

Re: Perl_peep (was Re: Perl_linklist)

Thread Previous | Thread Next
From:
Matt S Trout
Date:
December 3, 2008 13:48
Subject:
Re: Perl_peep (was Re: Perl_linklist)
Message ID:
20081203214829.GD21042@agaton.scsys.co.uk
On Wed, Nov 26, 2008 at 09:30:43PM +0000, Nicholas Clark wrote:
> On Wed, Nov 26, 2008 at 04:10:58PM +0000, Nicholas Clark wrote:
> > On Wed, Nov 26, 2008 at 04:36:34PM +0100, Rafael Garcia-Suarez wrote:
> > > 2008/11/26 Nicholas Clark <nick@ccl4.org>:
> > > > Do we want to make that policy decision? That optree construction is private.
> > > 
> > > If it's not private, it's public somehow. I merely want to assert that
> > > we don't support the internal API that is used to construct and
> > > optimise optrees. Perl_peep() is not public either, for example. Those
> > > are functions that do more than optree inspection.
> > 
> > To my mind the most logical way to assert that we don't support something is
> > to make it static whenever we can. So I made the appended change.
> > (And then went looking for other non-public non-static functions that the
> > core does not need outside the file of their definition)
> 
> To be consistent that would mean that Perl_peep() becomes static S_peep().
> Which, at least, will cause optimizer.xs to fail to link.
> 
> (Although, curiously, not B::Generate)
> 
> If we go all the way down the road of "the API used to construct and optimise
> optrees is internal" then we preclude certain potentially useful modules
> appearing on CPAN.
> 
> So should we provide some level of API? If so, what?

I'd like to be able to do much of what the compiler is able to currently.

I'm also aware that's a lot of API to maintain.

But at the very least I think we should consider current CPAN usages to be
a baseline - "some sort of op creation callback" plus "a way to construct your
own optree (fragments) and turn them into something runnable" plus "a way to
run an optree fragment" - though I wouldn't horribly mind building a proper
CV and executing it normally, I worry about the performance for that when
trying to do clever things like building macros (also when writing keywords
that take an expr ala map/grep, rather than just ones that take a sub).

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

Thread Previous | Thread Next


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