From c8e1a4ed4885c25ffa3893afe967867852769452 Mon Sep 17 00:00:00 2001 From: A404M Date: Fri, 30 May 2025 14:56:47 +0330 Subject: better operator overload --- code/main.felan | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'code/main.felan') diff --git a/code/main.felan b/code/main.felan index d629a26..98aa762 100644 --- a/code/main.felan +++ b/code/main.felan @@ -1,16 +1,6 @@ -@import("lib/operator.felan"); +@import("basic.felan"); -/* -print :: (value:anytype) -> void { - if comptime @type_of(value) == u8 { - @putc(value); - }else{ - @putc('h'); - } -}; -*/ - -print :: (value:*anytype)->void{ +print :: (value:**anytype)->void{ if comptime @type_of(value.*) == u8 { @putc(value.*); }else{ @@ -18,11 +8,16 @@ print :: (value:*anytype)->void{ } }; +__sum__ :: (left:*anytype,right:i64) -> (@type_of(left)) { + return @add(left,right); +}; + main :: ()->void{ - a := 'a'; - b := 123; - print(&a); - print(&b); - // print(123); + arr :[10]i64= undefined; + arr[0] = 2; + arr[1] = 3; + p := &arr[0]; + p += 1; + print(p.*); }; -- cgit v1.2.3