diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-24 14:18:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-24 14:18:22 -0400 |
| commit | be534f5e511a1d3836254b827cdaa2b8c309f5c4 (patch) | |
| tree | 478fc9ede3a1c61220d3b02a2524fb32d53e7300 /examples/learnxiny.tm | |
| parent | 788922fa2437c5b680b57d8adaaac9012fd5aba4 (diff) | |
Constructors and functions with underscore arguments should be allowed to be called, but
only if the underscore arguments are not provided but are implicit from
the default values. Same for constructing structs with private fields.
Diffstat (limited to 'examples/learnxiny.tm')
| -rw-r--r-- | examples/learnxiny.tm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm index 9b9f1017..7b1c74ca 100644 --- a/examples/learnxiny.tm +++ b/examples/learnxiny.tm @@ -182,13 +182,13 @@ func main() # different values using the "@" operator (think: "(a)llocate"). my_arr := @[10, 20, 30] my_arr[1] = 999 - >> my_arr - = @[999, 20, 30] + >> my_arr[] + = [999, 20, 30] # To call a method, you must use ":" and the name of the method: my_arr.sort() - >> my_arr - = @[20, 30, 999] + >> my_arr[] + = [20, 30, 999] # To access the immutable value that resides inside the memory area, you # can use the "[]" operator: @@ -200,8 +200,8 @@ func main() # remain unchanged. snapshot := my_arr[] my_arr.insert(1000) - >> my_arr - = @[20, 30, 999, 1000] + >> my_arr[] + = [20, 30, 999, 1000] >> snapshot = [20, 30, 999] # Internally, this is implemented using copy-on-write, so it's quite |
