v0.5.0 - Go-Native Generic Syntax
Dingo v0.5.0 - Go-Native Generic Syntax
This release adopts Go's native generic syntax [T] and removes architectural technical debt from the codebase.
⚠️ Breaking Changes
Generic Syntax Change: <T> → [T]
Dingo now uses Go's native generic syntax directly. This aligns Dingo with idiomatic Go code and eliminates the translation layer.
Before (v0.4.x):
func FindUser(id int) Result<User, error> {
return Ok<User, error>(user)
}
type Settings struct {
Theme Option<string>
}
After (v0.5.0):
func FindUser(id int) Result[User, error] {
return Ok[User, error](user)
}
type Settings struct {
Theme Option[string]
}
Migration Guide
Update all .dingo files:
Result<T, E>→Result[T, E]Option<T>→Option[T]Ok<T, E>(...)→Ok[T, E](...)Err<T>(...)→Err[T](...)Some<T>(...)→Some[T](...)None<T>()→None[T]()
You can use this sed command to migrate:
find . -name "*.dingo" -exec sed -i '' \
-e 's/Result<\([^>]*\)>/Result[\1]/g' \
-e 's/Option<\([^>]*\)>/Option[\1]/g' \
-e 's/Ok<\([^>]*\)>/Ok[\1]/g' \
-e 's/Err<\([^>]*\)>/Err[\1]/g' \
-e 's/Some<\([^>]*\)>/Some[\1]/g' \
-e 's/None<\([^>]*\)>/None[\1]/g' {} \;🏗️ Architectural Improvements
Removed Regex-Based Feature Detection
The plugin system no longer uses regex patterns to detect Dingo syntax. This eliminates:
- False positives from regex matching
- Unnecessary complexity in the codebase
- Violation of the "no string manipulation" architectural principle
Feature detection was removed entirely because disabled features cause compile errors anyway, making detection redundant.
Cleaner Parser Architecture
The enum parser now directly accepts [T, E] syntax without a transformation layer. This:
- Simplifies the parsing pipeline
- Reduces potential for bugs
- Aligns with the architectural principle:
Source → Tokenizer → Parser → AST → Codegen
🔧 Tuple Improvements
- Fixed tuple literal detection to prevent false positives
- Improved multi-pass parsing for complex tuple scenarios
- Corrected token position handling in destructuring transforms
📖 Documentation
All examples, tests, and documentation have been updated to use the new [T] syntax.
Full Changelog: v0.4.0...v0.5.0