# Task 010: Standalone Constructors
## ๐ **Overview**
Introduce body( struct/enum ) attribute `standalone_constructors` which create stand-alone, top-level constructors for struct/enum.
## ๐ฏ **Objectives**
- Add `standalone_constructors` attribute for struct/enum bodies
- For struct: create single constructor function
- For enum: create as many functions as enum has variants
- If no `arg_for_constructor` then constructors expect exactly zero arguments
- Start from implementations without respect of attribute `arg_for_constructor`
- By default `standalone_constructors` is false
## ๐ง **Technical Details**
### Struct Constructor
- Create stand-alone, top-level constructor function
- Name: same as struct but snake_case (e.g., `MyStruct` โ `my_struct()`)
- Single function per struct
### Enum Constructor
- Create separate constructor function for each variant
- Name: same as variant but snake_case (e.g., `MyVariant` โ `my_variant()`)
- Multiple functions per enum (one per variant)
### Default Behavior
- `standalone_constructors` defaults to `false`
- Only generate constructors when explicitly enabled
## ๐ **Source Location**
File: `/home/user1/pro/lib/wTools/module/core/component_model/src/lib.rs`
Line: 11
## ๐ท๏ธ **Labels**
- **Type**: Feature Enhancement
- **Priority**: Medium
- **Difficulty**: ๐ก Medium
- **Value**: ๐ Medium
- **Status**: ๐ Planned
## ๐ฆ **Dependencies**
- Component model core functionality
- Macro generation system
## ๐งช **Acceptance Criteria**
- [ ] Add `standalone_constructors` attribute parsing
- [ ] Generate standalone constructor for structs
- [ ] Generate multiple constructors for enum variants
- [ ] Use snake_case naming convention
- [ ] Handle zero-argument constructors by default
- [ ] Add comprehensive tests
- [ ] Update documentation with examples