chaokunyang opened a new issue, #3224:
URL: https://github.com/apache/fory/issues/3224

   ### Feature Request
   
   Add `weak_ref` Field Option to FDL for Weak References (C++/Rust)
   
   ### Is your feature request related to a problem? Please describe
   
   FDL already supports `ref` for reference tracking (shared/circular object 
graphs).  
   For C++ and Rust code generation, certain edges in cyclic object graphs 
(e.g., `parent` pointers, caches, observer links) must be represented as *weak* 
references to avoid ownership cycles and leaks.
   
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   
   add a **field-level option** named `weak_ref` (not a new keyword) to 
indicate that a `ref` field must be generated as a weak reference in C++/Rust.
   
   > Note (protobuf IDL support): this document shows options as `weak_ref` / 
`thread_safe_pointer`. In protobuf-style IDL these may be encoded as extension 
options (e.g., `(fory).weak_ref`, `(fory).thread_safe_pointer`). The compiler 
should accept the protobuf extension form while exposing the logical option 
name (without prefix) in internal IR and documentation.
   
   ---
   
   ## New Syntax (FDL)
   Example:
   ```protobuf
   message Node {
     string value = 1;
     ref Node parent = 2 [weak_ref = true];
     repeated ref Node children = 3;
   }
   
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to