Hi Chris,
just to late for the latest version. Today I found that right-click on an interface and then 'Implement "Iblabla" Interface members ...' still produces 'VIRTUAL' in front of the method name. 'VIRTUAL' was wrongly forced by vulcan, but is not needed in x# anymore.
PUBLIC CLASS YesNoToBooleanConverter IMPLEMENTS IValueConverter
right-click on IValueConverter gives
VIRTUAL METHOD Convert(value AS OBJECT, targetType AS System.Type, parameter AS OBJECT, culture AS System.Globalization.CultureInfo) AS OBJECT
RETURN NULL
VIRTUAL METHOD ConvertBack(value AS OBJECT, targetType AS System.Type, parameter AS OBJECT, culture AS System.Globalization.CultureInfo) AS OBJECT
RETURN NULL
VIRTUAL should be omitted here.
Frank
Auto-Implement Interfaces
-
- Posts: 178
- Joined: Sat Dec 05, 2015 10:44 am
- Location: Germany
Auto-Implement Interfaces
Thanks Frank, you are right of course.
I will leave it as it is for vulcan apps, but will change the code generation for x# ones. Very easy to fix of course, I will send you tomorrow a new dll to use.
Chris
I will leave it as it is for vulcan apps, but will change the code generation for x# ones. Very easy to fix of course, I will send you tomorrow a new dll to use.
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Auto-Implement Interfaces
Hi Chris,
personally I like the "virtual" even in X#.
Wolfgang
personally I like the "virtual" even in X#.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
-
- Posts: 178
- Joined: Sat Dec 05, 2015 10:44 am
- Location: Germany
Auto-Implement Interfaces
Wolfgang,
VIRTUAL only makes sense if you design a base class that can be inherited. And only for those members that are subject to be overridden. It is important at this point to do the design accordingly.
In most cases VIRTUAL is useless. It only slows down the program execution.
Frank
VIRTUAL only makes sense if you design a base class that can be inherited. And only for those members that are subject to be overridden. It is important at this point to do the design accordingly.
In most cases VIRTUAL is useless. It only slows down the program execution.
Frank
Auto-Implement Interfaces
Hi Frank,
yes, I know that, but nevertheless I prefer virtual methods and properties, and specially classes that are implementing interfaces normally are destined to be inherited.
Classes that should be "used" are then inherited from these, and overwrite the methods and properties only when needed.
This way I can define the default behavior in the parent classes and don't need to write code in every subclass.
I have precise ideas now about my systems are to be constructed (finally - after a lot of errors and changes).
Wolfgang
yes, I know that, but nevertheless I prefer virtual methods and properties, and specially classes that are implementing interfaces normally are destined to be inherited.
Classes that should be "used" are then inherited from these, and overwrite the methods and properties only when needed.
This way I can define the default behavior in the parent classes and don't need to write code in every subclass.
I have precise ideas now about my systems are to be constructed (finally - after a lot of errors and changes).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Auto-Implement Interfaces
Hi Wolfgang,
OK, will make the new behavior optional, with a preferences setting.
Frank, I think it all boils down to personal preferences. My personal view on this is that methods should be either sealed or virtual, never something in between. But I know some people will freak out by reading this . Just a personal preference..
Chris
OK, will make the new behavior optional, with a preferences setting.
Frank, I think it all boils down to personal preferences. My personal view on this is that methods should be either sealed or virtual, never something in between. But I know some people will freak out by reading this . Just a personal preference..
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
-
- Posts: 178
- Joined: Sat Dec 05, 2015 10:44 am
- Location: Germany
Auto-Implement Interfaces
Chris,
I also like to write those impicitly. I like to write "VIRTUAL" and "SEALED" more than deleting defaults. I like explict interface declaration:
SEALED PUBLIC CLASS YesNoToBooleanConverter IMPLEMENTS IValueConverter
METHOD IValueConverter.Convert(value AS OBJECT, targetType AS System.Type, parameter AS OBJECT, culture AS System.Globalization.CultureInfo) AS OBJECT
RETURN NULL
END CLASS
is how it should be. It's subject to permanent refactoring to change whenever I work on old code.
Frank
you're absolutly right, both what it should be and how some people will react on. That's why I have sealed most of my classes. Did not show in this example however.Chris wrote:My personal view on this is that methods should be either sealed or virtual, never something in between. But I know some people will freak out by reading this .
I also like to write those impicitly. I like to write "VIRTUAL" and "SEALED" more than deleting defaults. I like explict interface declaration:
SEALED PUBLIC CLASS YesNoToBooleanConverter IMPLEMENTS IValueConverter
METHOD IValueConverter.Convert(value AS OBJECT, targetType AS System.Type, parameter AS OBJECT, culture AS System.Globalization.CultureInfo) AS OBJECT
RETURN NULL
END CLASS
is how it should be. It's subject to permanent refactoring to change whenever I work on old code.
Frank
Auto-Implement Interfaces
Hi Chris,
thank you very much! Indeed this are personal preferences.
Wolfgang
thank you very much! Indeed this are personal preferences.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
-
- Posts: 178
- Joined: Sat Dec 05, 2015 10:44 am
- Location: Germany
Auto-Implement Interfaces
I don't know how this weird formatting applied. I clicked 'Preview' before submit.
Auto-Implement Interfaces
You hade 2 Quote markers in your message. The style sheet wants to center quotes
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu