c3c icon indicating copy to clipboard operation
c3c copied to clipboard

[Enhancement] Rename Turple to Pair

Open EroMrinin134 opened this issue 6 months ago • 3 comments

It feels like the more appropriate name for a general struct with 2 values is Pair not Tuple. I hope that this change wouldn't affect any current codebase due to rarety usage of tuple types. It is also would be nice to see Quad which holds 4 values.

EroMrinin134 avatar Jun 17 '25 12:06 EroMrinin134

Set up a poll on the discord for it perhaps?

lerno avatar Jun 17 '25 16:06 lerno

Set up a poll on the discord for it perhaps?

Good idea.

EroMrinin134 avatar Jun 17 '25 17:06 EroMrinin134

To add more suport for struct-types, these kind of methods could be added:

macro void Pair.@decompose(&self, Type1 #var1, Type2 #var2)
{
    #var1 = self.first;
    #var2 = self.second;
}

macro void Pair.@restruct(&self, #struct, #field_name1, #field_name2)
{
    #struct.$eval(#field_name1) = self.first;
    #struct.$eval(#field_name2) = self.second;
}

EroMrinin134 avatar Jun 26 '25 10:06 EroMrinin134

I am getting confused by the symbols soup here. I hope it serves a good purpose once learnt. :D

Ccocconut avatar Jul 02 '25 23:07 Ccocconut

This is not code you should normally write @Ccocconut

lerno avatar Jul 03 '25 10:07 lerno

This is not code you should normally write @Ccocconut

Thank you!

Ccocconut avatar Jul 05 '25 17:07 Ccocconut