+ Version 1.3.0 - Time and Precision
+ Released: May 30th 2025
+
+ Mastering Time and Fixing the Fundamentals
+ Version 1.3.0 brings essential time-handling capabilities to Gem while addressing critical scoping issues that were affecting variable resolution. This release focuses on two key areas: providing developers with robust time operations and ensuring the language's core scoping mechanisms work reliably.
+
+ The new Time module enables everything from simple delays to sophisticated performance monitoring, while our scoping fixes ensure that variables behave predictably across all contexts. Together, these improvements make Gem more reliable and capable for real-world applications.
+
+ We'd like to give a special thanks to @DevYatsu for their excellent work on the Time module!
+
+ What Changed
+
+ Time Module - Comprehensive Time Operations
+ The new Time standard library module provides essential time-related functionality for modern applications:
+
+
+
require "time";
+
+# Get current timestamp
+puts "Current time: #{Time.now()}";
+
+# Sleep operations with millisecond precision
+puts "Starting operation...";
+Time.sleep(2000); # Sleep for 2 seconds
+puts "Operation completed";
+
+# Function timing for performance monitoring
+def heavyWork() void
+ Time.sleep(1500); # Simulate 1.5 seconds of work
+ puts "Heavy work completed";
+end
+
+# Measure execution time
+Time.measure(heavyWork);
+
+# Timeout operations for reliability
+def quickTask() void
+ puts "Quick task executed";
+end
+
+def slowTask() void
+ Time.sleep(5000); # 5 second operation
+ puts "Slow task completed";
+end
+
+# Run with timeout protection
+Time.timeout(quickTask, 2); # Should complete
+Time.timeout(slowTask, 2); # May timeout
+
+
+ Critical Scoping Bug Fixes
+ We've resolved several important scoping issues that were causing variable resolution problems:
+
+
+
# Variable scoping now works correctly in all contexts
+def outerFunction() void
+ string message = "Hello from outer";
+
+ def innerFunction() void
+ # Can now properly access outer scope variables
+ puts message; # Works correctly
+
+ string localMessage = "Hello from inner";
+ puts localMessage; # Local scope works too
+ end
+
+ innerFunction();
+end
+
+# Class method scoping improvements
+class Calculator
+ def init() void
+ this.value = 0;
+ end
+
+ def calculate() void
+ # Method-local variables now scope correctly
+ int localResult = this.value * 2;
+ this.value = localResult; # 'this' resolution fixed
+ end
+end
+
+
+ Technical Implementation
+
+ Time Module Architecture
+ The Time module is implemented using system-level time functions for accuracy and reliability:
+
+ - High-precision timestamps - Floating-point timestamps provide microsecond accuracy
+ - Cross-platform sleep - Millisecond-precision sleep works on all supported platforms
+ - Function timing - Accurate measurement of function execution duration
+ - Timeout handling - Attempt to limit function execution time (implementation-dependent)
+
+
+ Scoping System Improvements
+ The scoping fixes address fundamental issues in variable resolution:
+
+ - Lexical scoping - Variables are now correctly resolved based on lexical scope
+ - Closure capture - Inner functions properly capture outer scope variables
+ - Method resolution - Class method variable lookup works reliably
+ - Scope chain traversal - Proper traversal of nested scopes during variable lookup
+
+
+ Design Philosophy
+ Version 1.3.0 reflects our commitment to both expanding Gem's capabilities and ensuring rock-solid fundamentals:
+
+
+ - Essential Functionality - Time operations are fundamental to modern applications
+ - Reliability First - Scoping bugs undermine developer confidence and must be fixed
+ - Practical Utility - Time module enables performance monitoring and timeout handling
+ - Consistent Behavior - Variable scoping should be predictable and intuitive
+
+
+ Known Limitations
+ While the Time module provides essential functionality, there are some current limitations:
+
+ - Duration Class - Advanced duration arithmetic is not yet available
+ - Time.elapsed() - Has type compatibility issues and is not recommended
+ - Timeout Reliability - Timeout interruption may not work in all scenarios
+ - Return Value Handling - Some functions return values that are difficult to access
+
+
+ Looking Forward
+ The Time module foundation opens possibilities for future enhancements like date/time parsing, timezone handling, and more sophisticated timing utilities. It also lays the groundwork for more advanced features like async/await, cryptography, random number generation, and more. The scoping fixes ensure that Gem's core language mechanics are solid as we continue to build more advanced features.
+
+