You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Improve module system validation and restrictions
- Enhanced export constant validation to verify items are actually constants
- Improved type checking for include/export statements with proper error messages
- Relaxed control flow restrictions to allow return statements in included files
- Clarified export statement documentation with current benefits and usage
Fixes identified issues from code review while maintaining backward compatibility.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: logbie <logbie@users.noreply.github.com>
Copy file name to clipboardExpand all lines: Docs/04-advanced-features/modules.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -510,9 +510,9 @@ end try
510
510
511
511
## Limitations
512
512
513
-
## Export Statement (V2 Foundation)
513
+
## Export Statement
514
514
515
-
WFL now includes an `export` statement that validates the existence of items for future module namespaces:
515
+
WFL includes an `export` statement that documents and validates module interfaces:
516
516
517
517
```wfl
518
518
# Define items in a module
@@ -527,13 +527,18 @@ end
527
527
528
528
store constant VERSION as "1.0.0"
529
529
530
-
# Export specific items for future namespace features
530
+
# Document which items are intended for external use
531
531
export container Person
532
532
export action greet
533
533
export constant VERSION
534
534
```
535
535
536
-
The export statement currently validates that the named item exists in the current scope. In future versions, this will enable selective module exposure.
536
+
**Current Benefits:**
537
+
-**Documentation**: Makes module interface explicit and clear
538
+
-**Validation**: Ensures exported items actually exist at compile/lint time
539
+
-**Best Practices**: Encourages conscious design of module interfaces
540
+
541
+
**Future Enhancements:** The export statement establishes the foundation for selective module exposure and namespace control in future WFL versions.
0 commit comments