Propagate polymorphic to lambda
This commit is contained in:
@@ -26,8 +26,12 @@ Array :: struct($T: Type)
|
||||
Tuple :: struct($A: Type, $B: Type)
|
||||
a: A
|
||||
b: B
|
||||
Triple :: struct($A: Type, $B: Type, $C: Type)
|
||||
a: A
|
||||
b: B
|
||||
c: C
|
||||
|
||||
make_array :: (a: *int, count: int): Array(int)
|
||||
MakeArray :: (a: *int, count: int): Array(int)
|
||||
result := Array(int) {
|
||||
data = a,
|
||||
len = count,
|
||||
@@ -39,9 +43,13 @@ make_array :: (a: *int, count: int): Array(int)
|
||||
// @todo: maybe disallow multiple arguments in current form
|
||||
// and use polimorphism. Then we could make var unpacking,
|
||||
// unpack structs making it more powerful
|
||||
multiple_args :: (): Tuple(int, F32)
|
||||
MultipleArgs :: (): Tuple(int, F32)
|
||||
return {32, 32}
|
||||
|
||||
PolyLambda :: (value: $T): T
|
||||
pass
|
||||
|
||||
|
||||
main :: (argc: int, argv: **char): int
|
||||
buff: *int
|
||||
array: Array(int) = {len = 10, cap = 10, data = buff}
|
||||
@@ -50,6 +58,7 @@ main :: (argc: int, argv: **char): int
|
||||
fourth: Array(F32)
|
||||
fifth: Array(F32)
|
||||
|
||||
a,b := multiple_args()
|
||||
// a,b := MultipleArgs()
|
||||
a := MultipleArgs()
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user