mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-05 22:48:43 +00:00
other symbol for reference types, any references in reference type
This commit is contained in:
parent
fe6507ae12
commit
7f3dfd71a1
6 changed files with 14 additions and 16 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#!/usr/bin/env lang
|
||||
|
||||
:: module; // import module to current namespace
|
||||
|
|
@ -146,13 +145,13 @@ bubble_sort_2 'arr : ref Array['A] = {
|
|||
};
|
||||
}
|
||||
|
||||
: example of ^ and generics. ^ used to denote that this object allocated on heap
|
||||
: example of <> and generics. <> (in type definition) used to denote that this object allocated on heap
|
||||
: object allocated by unique reference by default
|
||||
^TreeNode 'Key 'Value =
|
||||
<> TreeNode 'Key 'Value =
|
||||
& @key Key
|
||||
& @value Value
|
||||
& @left ^TreeNode['Key 'Value]
|
||||
& @right ^TreeNode['Key 'Value];
|
||||
& @left <> TreeNode['Key 'Value]
|
||||
& @right <> TreeNode['Key 'Value];
|
||||
|
||||
.new = do_something; // static methods
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue