what is the preferred way - functions/static methods or extension methods

This forum is meant for questions and discussions about the XSharp Tools libraries, which contain code written by XSharp users that they want to share with others,
The development team is not responsible for this code

Moderator: wriedmann

User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

what is the preferred way - functions/static methods or extension methods

Post by wriedmann »

Hi Jamal,

thank you - so we are at 5.5 : 3.25 now.

Regarding your comment about dot or colon: in the Core dialect you can use the dot instead of the colon. But at least XIDE does not support that in thew editor, I don't know about Visual Studio.

Personally I prefer the colon because it makes it clearer where a method comes from - it is easier to read.
It seems to be a similar question as "implements" and "inherit" - X# makes a difference and the code easier to read, whereas C# is shorter, but IMHO harder to read.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

what is the preferred way - functions/static methods or extension methods

Post by Horst »

Hi
i like functions, i dont like when a variable has addional features.
a varibale is a variable and finish. keep it simple.

so this -> cString := cMotherString.Substr (1,5) i dont like.

and btw i like the russian doll modell ;-) because its like mathematik first clean up the inner clips.

also in VO, all the methods of a class will be compiled and blows up the executable, even you need only one method of the class in the whole program.

Horst
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

what is the preferred way - functions/static methods or extension methods

Post by wriedmann »

Hi Horst,
a varibale is a variable and finish. keep it simple.
a variable can be an object - in fact in .NET everything is an object, even a string or an integer. And an object can have methods.

Therefore I like extension methods, as they allow to use the same method name on different object or variable types.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Fab64
Posts: 63
Joined: Mon Nov 23, 2015 12:26 pm

what is the preferred way - functions/static methods or extension methods

Post by Fab64 »

also for me extension method

Fabrizio
Post Reply