@shd101wyy/yo 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -179,6 +179,8 @@ impl(forall(T), where(T <: ToString), Box(T),
179
179
  ```
180
180
 
181
181
  - Use `Self` inside impl method signatures
182
+ - Use `Self` inside `struct(...)`, `object(...)`, `enum(...)` definitions for recursive type references (the type name is not yet available during its own definition)
183
+ - `Self` also works inside generic type constructors — it refers to the current instantiation (e.g., `Tree(T)` inside `Tree`). Use `recur(args)` only when the type arguments differ from the current instantiation.
182
184
  - `forall(T)` + `where(T <: Trait)` for generic impls
183
185
  - Trait impls: `impl(MyType, MyTrait(args), : trait_field_bindings...)`
184
186
 
@@ -122,8 +122,10 @@ impl(Counter,
122
122
  ```
123
123
 
124
124
  - No space between a function type and its body: `(fn(...) -> T)(...)`
125
- - Use `Self` in method signatures
125
+ - Use `Self` in method signatures and in type definitions for recursive references (the type name is not available during its own definition)
126
+ - `Self` also works inside generic type constructors — it refers to the current instantiation (e.g., `Tree(T)` inside `Tree`). Use `recur(args)` only when type arguments differ from the current instantiation.
126
127
  - Wrap `fn` types in parentheses when they appear after `:`
128
+ - **Forward references between methods in the same `impl` block are supported.** A method defined later in the block can be called by a method defined earlier. Both `self.method()` and `Self.method(...)` dispatch work. Only the canonical `name : (fn(...) -> R)(body)` method shape participates; bare lambdas do not get forward-ref shells.
127
129
 
128
130
  ### Named arguments and default values
129
131