Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 085a27a

Browse files
committed
Fix formatting inconsistencies in basic.md for improved readability
1 parent 55f82e5 commit 085a27a

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

basic.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### 📚 Diagrams Overview
66

7-
This **RFC** is quite complex due to the number of logical connections.
7+
This **RFC** is quite complex due to the number of logical connections.
88
Please use the diagrams from the table to simplify understanding.
99

1010
| Diagram Name | Description |
@@ -226,12 +226,12 @@ function mergeFiles(string ...$files): string
226226

227227
### Scheduler and Reactor
228228

229-
**Scheduler** and **Reactor** must be implemented as `PHP` extensions that implement low-level interfaces.
229+
**Scheduler** and **Reactor** must be implemented as `PHP` extensions that implement low-level interfaces.
230230

231231
The **Scheduler** and **Reactor** interfaces are part of the implementation of this **RFC**.
232232

233233
The behavior of **Scheduler** and **Reactor** must not contradict the logic of the **RFC**.
234-
Components cannot override the logic of expressions such as spawn, async, suspend, and so on.
234+
Components cannot override the logic of expressions such as spawn, async, suspend, and so on.
235235
However, this **RFC** does not impose any restrictions on extending functionality.
236236

237237
It is allowed to use the **Async** namespace for new functions or objects in **Scheduler** and **Reactor**.
@@ -298,7 +298,7 @@ However, it cannot be stopped externally.
298298
> It is permissible to stop a coroutine’s execution externally for two reasons:
299299
> * To implement multitasking.
300300
> * To enforce an active execution time limit.
301-
> Please see [Maximum activity interval](#maximum-activity-interval) for more information.
301+
> Please see [Maximum activity interval](#maximum-activity-interval) for more information.
302302
303303
A suspended coroutine can be resumed at any time.
304304
The `Scheduler` component is responsible for the coroutine resumption algorithm.
@@ -944,7 +944,7 @@ Caught exception: Error
944944
#### Task Race
945945

946946
Sometimes it's necessary to get the result of the fastest task from a set.
947-
The **`Scope::firstDirectTask`** method returns a trigger
947+
The **`Scope::firstDirectTask`** method returns a trigger
948948
that fires as soon as at least one of the direct tasks in the **Scope** is completed.
949949

950950
**Example:**
@@ -1148,7 +1148,7 @@ Resource control at the top level is a useful tool for organizing applications,
11481148
11491149
##### Explicit and Implicit Tasks
11501150
1151-
The division of coroutines into explicit and implicit tasks is unique to this **RFC**
1151+
The division of coroutines into explicit and implicit tasks is unique to this **RFC**
11521152
and does not exist in any other language.
11531153
11541154
The **Java Loom** project, for example, requires that the `Scope` is always explicitly specified.
@@ -1157,7 +1157,7 @@ It is possible to discard the `spawn` expression without specifying
11571157
a `Scope` or always create a coroutine in the global scope,
11581158
as **Java Loom** and **Kotlin** do.
11591159
1160-
However, explicit task creation in the global scope is prohibited by the rules of this RFC,
1160+
However, explicit task creation in the global scope is prohibited by the rules of this RFC,
11611161
as it is considered an **antipattern** that is well-studied.
11621162
11631163
The ability to control the default `Scope` for `spawn` allows frameworks to manage user code by enforcing common rules.
@@ -1377,7 +1377,7 @@ The following expressions do not affect the reference count of the `$scope` obje
13771377
* `Scope::inherit($scope)` does **not** increase the reference count of either the parent or the child `$scope`.
13781378

13791379
The following statements are true:
1380-
1. The lifetime of a child `Scope` cannot exceed that of its parent.
1380+
1. The lifetime of a child `Scope` cannot exceed that of its parent.
13811381
If the parent is destroyed, the child `Scope` will be closed.
13821382
2. If the child `Scope` is released, the parent will automatically lose its connection to it.
13831383

@@ -1477,10 +1477,7 @@ A new child `Scope` can be created using a special constructor:
14771477
It returns a new `Scope` object that acts as a child.
14781478
A coroutine created within the child `Scope` can also be considered a child relative to the coroutines in the parent `Scope`.
14791479

1480-
The advantage of a child `Scope` is that it’s not “detached” — it’s attached to its parent.
1481-
The code that owns the parent `Scope` can control the entire hierarchy of coroutines at once.
1482-
1483-
Let’s look at an example.
1480+
**An example:**
14841481

14851482
```php
14861483
use Async\Scope;
@@ -1571,7 +1568,7 @@ function socketServer(): void
15711568
```
15721569
Let's examine how this example works.
15731570

1574-
1. `socketServer` creates a new Scope for coroutines that will handle all connections.
1571+
1. `socketServer` creates a new `Scope` for coroutines that will handle all connections.
15751572
2. Each new connection is processed using `connectionHandler()` in a separate `Scope`,
15761573
which is inherited from the main one.
15771574
3. `connectionHandler` creates a new `Scope` for the `connectionLimiter` and `connectionChecker` coroutines.
@@ -2075,7 +2072,7 @@ The following scenarios are considered potentially erroneous:
20752072
1. A coroutine belongs to a global scope and is not awaited by anyone (a **zombie coroutine**).
20762073
2. The root scope has been destroyed (its destructor was called), but no one awaited
20772074
it or ensured that its resources were explicitly cleaned up (e.g., by calling `$scope->cancel()` or `$scope->dispose()`).
2078-
3. Tasks were not cancelled using the `cancel()` method, but through a call to `dispose()`.
2075+
3. **Implicit Tasks** were not cancelled using the `cancel()` method, but through a call to `dispose()`.
20792076
This indicates that the programmer did not intend to cancel the execution of the coroutine,
20802077
yet it happened because the scope was destroyed.
20812078
4. Deadlocks caused by circular dependencies between coroutines.
@@ -3046,7 +3043,7 @@ The `Async\getCoroutines()` method returns an array of all coroutines in the app
30463043

30473044
#### Parallels with Java Loom
30483045

3049-
This **RFC** unintentionally contains many parallels with the Java Loom StructuredTaskScope API,
3046+
This **RFC** unintentionally contains many parallels with the Java Loom StructuredTaskScope API,
30503047
which is very similar to this **RFC**.
30513048

30523049
| **Feature** | **PHP True Async (Scope)** | **Java Loom (StructuredTaskScope)** |

0 commit comments

Comments
 (0)