WOO YEE Basic polymorphism for untyped values, not working for typed expressions yet
This commit is contained in:
@@ -47,12 +47,16 @@ MakeArray :: (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
|
||||
// a,b := MultipleArgs() // @todo var unpacking
|
||||
MultipleArgs :: (): Tuple(int, F32)
|
||||
return {32, 32}
|
||||
|
||||
PolyLambda :: ($T: Type = *int): T
|
||||
return 32
|
||||
|
||||
PolyType :: (a: $T): T
|
||||
return a
|
||||
|
||||
GetCount :: (a: int): int
|
||||
return a
|
||||
|
||||
@@ -78,7 +82,7 @@ main :: (argc: int, argv: **char): int
|
||||
|
||||
// c := MakeArray(buff, GetCount(GetCount(32)))
|
||||
|
||||
// a,b := MultipleArgs()
|
||||
|
||||
a := MultipleArgs()
|
||||
|
||||
Test(10)
|
||||
@@ -89,5 +93,10 @@ main :: (argc: int, argv: **char): int
|
||||
Test(a = 10, b = 10, c = 20)
|
||||
|
||||
value := PolyLambda(**int)
|
||||
PolyType_r1 := PolyType(10)
|
||||
PolyType_r2 := PolyType(int)
|
||||
// PolyType_r3 := PolyType(array)
|
||||
// PolyType_r4 := PolyType(seventh)
|
||||
// PolyType_r5 := PolyType(sixth)
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user