2008/12/3 Matt S Trout <matt-p5p@trout.me.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). That's true. An optree constructed by hand is made "runnable" by linklist. Actually it's a good way to describe what linklist does. That would be a good argument to make linklist public.Thread Previous | Thread Next