Core: Polymorphism works better then expected hmm...
This commit is contained in:
@@ -35,11 +35,6 @@ MakeArray :: (a: *int, count: int): Array(int)
|
||||
}
|
||||
return result
|
||||
|
||||
// :Multiple arguments
|
||||
// @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}
|
||||
|
||||
@@ -52,13 +47,6 @@ PolyType :: (a: $T): T
|
||||
GetCount :: (a: int): int
|
||||
return a
|
||||
|
||||
// @todo: this is allowed, shouldn't be
|
||||
// Test :: (a: int, b: int = 10, c: int???)
|
||||
|
||||
// @todo:
|
||||
// Add :: (arr: *Array($T), item: T)
|
||||
// return
|
||||
|
||||
C :: #import "LibC.core"
|
||||
|
||||
Add :: (arr: *Array($T), val: T)
|
||||
@@ -83,22 +71,22 @@ main :: (argc: int, argv: **char): int
|
||||
|
||||
// c := MakeArray(buff, GetCount(GetCount(32)))
|
||||
|
||||
|
||||
a := MultipleArgs()
|
||||
a, b := MultipleArgs()
|
||||
Assert(a == 32 && b == 32)
|
||||
|
||||
Add(&array, 32)
|
||||
Add(&second_array, 32)
|
||||
Add(&third_array, 32)
|
||||
Add(&fourth, 32)
|
||||
Add(&fifth, 32)
|
||||
// Add(&sixth, {32}) // @todo this is possible !
|
||||
Add(&sixth, {})
|
||||
|
||||
// value := PolyLambda(**int)
|
||||
// PolyType_r1 := PolyType(10)
|
||||
// PolyType_r2 := PolyType(int)
|
||||
PolyType_r5 := PolyType(seventh)
|
||||
// PolyType_r3 := PolyType(test)
|
||||
// PolyType_r4 := PolyType(test_a)
|
||||
// PolyType_r5 := PolyType(sixth)
|
||||
value := PolyLambda(**int)
|
||||
PolyType_r1 := PolyType(10)
|
||||
PolyType_r2 := PolyType(int)
|
||||
PolyType_r3 := PolyType(test)
|
||||
PolyType_r4 := PolyType(test_a)
|
||||
PolyType_r5 := PolyType(sixth)
|
||||
PolyType_r6 := PolyType(seventh)
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user