aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/dev
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/php-rpc.md4
-rw-r--r--docs/dev/plugin-class-classification.md7
-rw-r--r--docs/dev/plugin-stub-generation.md10
3 files changed, 10 insertions, 11 deletions
diff --git a/docs/dev/php-rpc.md b/docs/dev/php-rpc.md
index 298b4059..e6797533 100644
--- a/docs/dev/php-rpc.md
+++ b/docs/dev/php-rpc.md
@@ -168,7 +168,9 @@ Both sets are written into the same autoload directory at worker spawn and resol
highest priority, so these FQCNs can never be shadowed by the real implementation;
`__shirabe_require` restores that priority after loading code that prepends its own autoloader.
Stubs are interned per rhandle (`WeakReference`-based registry) so identity (`===`) holds, and
-their destructors send `ReleaseRustHandle`.
+their destructors send `ReleaseRustHandle`. `clone` on a stub calls `__shirabeClone` on the
+entity and rebinds the copy to the handle that answers, so the two stubs never share (and never
+double-release) one entity; entities with no clone semantics answer with an explicit error.
## The P table
diff --git a/docs/dev/plugin-class-classification.md b/docs/dev/plugin-class-classification.md
index ab91ccda..ddba364d 100644
--- a/docs/dev/plugin-class-classification.md
+++ b/docs/dev/plugin-class-classification.md
@@ -436,13 +436,6 @@ which can cross the wire as values. The stub needs a bespoke story (e.g. a
local Table bound to a proxying `OutputInterface`); until one is designed,
both members raise explicit errors.
-### Proxy clone semantics
-
-`clone $package` is a common plugin idiom (and `NoopInstaller::install`
-does `$repo->addPackage(clone $package)`), but PHP `clone` on a proxy stub
-copies the handle, not the Rust entity. The stub generator needs a
-`__clone` that RPCs a clone of the entity. Undecided.
-
## The classifier tool
### Dependencies and layout
diff --git a/docs/dev/plugin-stub-generation.md b/docs/dev/plugin-stub-generation.md
index e10c0e9c..33025df7 100644
--- a/docs/dev/plugin-stub-generation.md
+++ b/docs/dev/plugin-stub-generation.md
@@ -72,9 +72,13 @@ the generator's vendor directory or the classifier report is unavailable.
* **Public instance properties** are not declared on the stub; `__get`/`__set`
forwarders carry every access (including dynamic-property writes) to the
Rust side, where an unsupported name is an explicit error.
-* **`__toString`** is forwarded like any other method. **`__clone`** emits a
- throwing body: proxy clone semantics are an open design question, and
- cloning must not silently share the Rust handle between two stubs.
+* **`__toString`** is forwarded like any other method. **`__clone`** is part of
+ the boilerplate on every stub, whether or not the real class declares one:
+ PHP has already copied the stub by the time it runs, so the copy asks the
+ Rust side for a clone of the entity and rebinds itself to the fresh handle
+ (`__shirabeClone`, answered with `[rhandle, epoch]`). The clone semantics of
+ the real class live on the Rust side with the entity; entities that model no
+ clone answer with an explicit error.
* **Imports**: the original file's `use` statements are kept in their original
order, restricted to names the emitted stub references; signatures declared
elsewhere (interface files) are re-spelled through that import table.