From ec6a8fb4b7dd5f187ac0fefc440ea0ba6f4ccbe9 Mon Sep 17 00:00:00 2001 From: GaragePixel Date: Fri, 18 Jul 2025 16:06:02 +0200 Subject: [PATCH 1/4] Delete modules/std/syntax/functors/minmax.xw --- modules/std/syntax/functors/minmax.xw | 93 --------------------------- 1 file changed, 93 deletions(-) delete mode 100644 modules/std/syntax/functors/minmax.xw diff --git a/modules/std/syntax/functors/minmax.xw b/modules/std/syntax/functors/minmax.xw deleted file mode 100644 index 40497c02..00000000 --- a/modules/std/syntax/functors/minmax.xw +++ /dev/null @@ -1,93 +0,0 @@ - -Namespace std.syntax - -'Minilib minmax -'iDkP from GaragePixel -'Since 2018-2025 - -Function Min:T1(a:T1,b:T2) Where T1 Implements INumeric And - T2 Implements INumeric - 'the limit value, if returned, is casted to the initial type - Return Cast(a:T Ptr(a:T Ptr,b:T Ptr) Where T Implements INumeric - - Return a[0]:T(a:T Ptr,b:T Ptr) Where T Implements INumeric -' 'return type overload? -' Return a[0]:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And - T2 Implements INumeric - 'the limit value, if returned, is casted to the initial type - Return Cast(a[0]:T(a:T,b:T,c:T) Where T Implements INumeric - - Return a:T Ptr(a:T Ptr,b:T Ptr,c:T Ptr) Where T Implements INumeric - - Return a[0]:T1(a:T1,b:T2,c:T3) Where T1 Implements INumeric And - T2 Implements INumeric And - T3 Implements INumeric - 'the limit value, if returned, is casted to the initial type - Return Cast(a:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INumeric And - T2 Implements INumeric And - T3 Implements INumeric - 'the limit value, if returned, is casted to the initial type - Return Cast(a[0]:T1(a:T1,b:T2) Where T1 Implements INumeric And - T2 Implements INumeric - Return a:T Ptr(a:T Ptr,b:T Ptr) Where T Implements INumeric - - Return a[0]:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And - T2 Implements INumeric - 'the limit value, if returned, is casted to the initial type - Return Cast(a[0]:T(a:T,b:T,c:T) Where T Implements INumeric - - Return a:T(a:T Ptr,b:T Ptr,c:T Ptr) Where T Implements INumeric - - Return a[0]:T1(a:T1,b:T2,c:T3) Where T1 Implements INumeric And - T2 Implements INumeric And - T3 Implements INumeric - 'the limit value, if returned, is casted to the initial type - Return Cast(a:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INumeric And - T2 Implements INumeric And - T3 Implements INumeric - 'the limit value, if returned, is casted to the initial type - 'Note that byte with int,float,double are incompatible - Return Cast(a[0] Date: Fri, 18 Jul 2025 16:06:15 +0200 Subject: [PATCH 2/4] Update syntax.xw --- modules/std/syntax/syntax.xw | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/std/syntax/syntax.xw b/modules/std/syntax/syntax.xw index df470e5c..9ed1ad37 100644 --- a/modules/std/syntax/syntax.xw +++ b/modules/std/syntax/syntax.xw @@ -13,6 +13,7 @@ Namespace std.syntax #Import "pointers/pointers" #Import "funcs/reflection" +#Import "funcs/minmax" #Import "funcs/swaps" #Import "funcs/clippers/clips" #Import "funcs/clippers/trims" From f75dc628da26fcf1016088aa02b41c073c99bc5c Mon Sep 17 00:00:00 2001 From: GaragePixel Date: Fri, 18 Jul 2025 16:06:41 +0200 Subject: [PATCH 3/4] Create minmax.wx --- modules/std/syntax/funcs/minmax.wx | 110 +++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 modules/std/syntax/funcs/minmax.wx diff --git a/modules/std/syntax/funcs/minmax.wx b/modules/std/syntax/funcs/minmax.wx new file mode 100644 index 00000000..2e7903d8 --- /dev/null +++ b/modules/std/syntax/funcs/minmax.wx @@ -0,0 +1,110 @@ + +Namespace stdlib.syntax + +'Minilib minmax +'iDkP from GaragePixel +'Since 2018-2025 + +'Note: In monkey library, the bad implemented min/max functions must be deactivated +'in order to make the multitypes min/max functions to works + +Function Min:T(a:T,b:T) Where T Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return a:T1(a:T1,b:T2) Where T1 Implements INumeric And + T2 Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return Cast(a:T Ptr(a:T Ptr,b:T Ptr) Where T Implements INumeric + + Return a[0]:T(a:T Ptr,b:T Ptr) Where T Implements INumeric + 'return type overload? + Return a[0]:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And + T2 Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return Cast(a[0]:T(a:T,b:T,c:T) Where T Implements INumeric + + '3 arguments breaks the overloading of the language min/max stuff + 'So the language library non-native stuff was undoned, + 'and in the the word we'll have peace! + + Return a:T Ptr(a:T Ptr,b:T Ptr,c:T Ptr) Where T Implements INumeric + + Return a[0]:T1(a:T1,b:T2,c:T3) Where T1 Implements INumeric And + T2 Implements INumeric And + T3 Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return Cast(a:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INumeric And + T2 Implements INumeric And + T3 Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return Cast(a[0]:T(a:T,b:T) Where T Implements INumeric + Return a:T1(a:T1,b:T2) Where T1 Implements INumeric And + T2 Implements INumeric + Return a:T Ptr(a:T Ptr,b:T Ptr) Where T Implements INumeric + + Return a[0]:T1(a:T1 Ptr,b:T2 Ptr) Where T1 Implements INumeric And + T2 Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return Cast(a[0]:T(a:T,b:T,c:T) Where T Implements INumeric + + Return a:T(a:T Ptr,b:T Ptr,c:T Ptr) Where T Implements INumeric + + Return a[0]:T1(a:T1,b:T2,c:T3) Where T1 Implements INumeric And + T2 Implements INumeric And + T3 Implements INumeric + 'the limit value, if returned, is casted to the initial type + Return Cast(a:T1(a:T1 Ptr,b:T2 Ptr,c:T3 Ptr) Where T1 Implements INumeric And + T2 Implements INumeric And + T3 Implements INumeric + 'the limit value, if returned, is casted to the initial type + 'Note that byte with int,float,double are incompatible + Return Cast(a[0] Date: Fri, 18 Jul 2025 16:07:20 +0200 Subject: [PATCH 4/4] Update minmax.wx --- modules/std/syntax/funcs/minmax.wx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/std/syntax/funcs/minmax.wx b/modules/std/syntax/funcs/minmax.wx index 2e7903d8..ee0bdc12 100644 --- a/modules/std/syntax/funcs/minmax.wx +++ b/modules/std/syntax/funcs/minmax.wx @@ -1,5 +1,5 @@ -Namespace stdlib.syntax +Namespace std.syntax 'Minilib minmax 'iDkP from GaragePixel