From 21c9a57d965a55c1d4aa0bd0e1622b938e69414e Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 1 Apr 2023 11:54:52 +0200 Subject: [PATCH] Comments --- core_compiler_interface.hpp | 6 ++++++ examples/_polymorphism.core | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/core_compiler_interface.hpp b/core_compiler_interface.hpp index 6582e9b..584cbc1 100644 --- a/core_compiler_interface.hpp +++ b/core_compiler_interface.hpp @@ -509,6 +509,12 @@ struct Ast_For : Ast { struct Ast_Lambda : Ast_Expr { Array args; + + // :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 + // @cleanup @refactor: return value shouldn't be a array of expressions. // It should be a single expression. So probably need a special type // for that. diff --git a/examples/_polymorphism.core b/examples/_polymorphism.core index d8d31f3..93a9c6d 100644 --- a/examples/_polymorphism.core +++ b/examples/_polymorphism.core @@ -23,6 +23,10 @@ Array :: struct($T: Type) len: int cap: int +Tuple :: struct($A: Type, $B: Type) + a: A + b: B + make_array :: (a: *int, count: int): Array(int) result := Array(int) { data = a, @@ -31,6 +35,12 @@ make_array :: (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 +multiple_args :: (): Tuple(int, F32) + return {32, 32} main :: (argc: int, argv: **char): int buff: *int @@ -40,4 +50,6 @@ main :: (argc: int, argv: **char): int fourth: Array(F32) fifth: Array(F32) + a,b := multiple_args() + return 0 \ No newline at end of file