Hi Larry,

Thanks, both mails land. You have changed my mind on the default, and I 
have updated the RFC to 0.10 accordingly.

A new scope now starts as a copy of its creator's state, for everything 
that follows the scope: the six request arrays, the session, and under 
vote B the default locale and timezone. The copy is PHP's copy of an 
array, so nothing is duplicated until one side writes, and from then on 
the two scopes are independent. Your show_flash_messages() sees the 
$_GET and $_SESSION its caller saw, and what it changes stays inside the 
scope.

I went one step further than you suggested and left out the opt-out. A 
server that starts a request wants a fresh set, but it gets one by 
constructing the request's scope from its own loop, which runs in the 
root scope: under the CLI the root's arrays are the CLI's and no session 
is open, so the copy is as good as empty, and the server fills the six 
as it does today. Anyone who wants a scope emptier than its creator's 
can clear what they do not want to pass on. Defining an "empty" option 
would mean defining what empty means for each kind of state, now and in 
every later RFC, which is exactly the per-concern work the copy rule 
avoids. And it can be added later without breaking anything, so leaving 
it out costs nothing now.

That also answers your point about future additions, and Côme's about 
moving things later. With the copy rule, a later RFC that adds, say, 
ini_set() values changes nothing for code that only reads them inside a 
scope; code that sets them gets containment, which is the point. So the 
bitmask is gone, and "a new scope starts empty" with it.

Two places where "copy" needed spelling out, which 0.10 does. The 
session: a scope constructed while a session is active holds the same id 
and status and a copy of $_SESSION; it does not open the session again, 
so a locking handler's lock is not taken twice, and a write-close in the 
copy writes under that id while the creator's later write-close wins, 
the same as keeping a copy of $_SESSION in a variable and restoring it. 
And output, which you flagged: headers and the body are not values to 
copy. A header set inside a scope must still reach the one response the 
request has, so they are a sink the creator supplies, by default its 
own, not state the copy rule can carry. That is why they need the 
integration points listed under Future Scope rather than a vote here, 
and I think it also answers whether they can be added later: yes, by 
that mechanism, and the copy rule does not stand in the way.

On listing everything that will eventually follow the scope and voting 
on it once: I am not against it, and the copy rule is what makes it 
possible without the 21 flags. Future Scope in 0.10 now says that list 
is the full picture this RFC is the first step of. Whether the vote 
should cover the list as a commitment, as with the resource-to-object 
conversion, I would like to hear from the core maintainers before 
restructuring the votes.

0.10 goes on the wiki today, with a changelog entry; the extension's 
next release implements the copy, its current one still starts empty.

Best regards,
Frode Børli

Reply via email to