Sendclass

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Sendclass

Post by ecos »

Hello,
the line

SendClass(SELF,#Setup,#DFSUBLister)

compiles without error, but the Method Setup of the Super-Super-Class DFSUBLister is not called.
What am I doing wrong

TIA
Karl
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Sendclass

Post by Karl-Heinz »

Hi Karl,

don ´t you get an obsolete compiler warning ? When i search "Function SendClass" on Github the result is:

Code: Select all

/// <exclude/>
[ObsoleteAttribute( "'SendClass()' is not supported and always returns NIL")] ;
FUNCTION SendClass( o , symMethod , symClassName ) AS USUAL CLIPPER
	RETURN NIL

regards
Karl-Heinz
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Sendclass

Post by ecos »

No warning...
So I have to find a workaround ?
I use this quite often in VO...
User avatar
Chris
Posts: 4986
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Sendclass

Post by Chris »

Hi Karl,

Maybe you have explicitly disabled showing that warning (it's number 618) in the project settings?

Any reason why you are using SendClass() instead of Send()? Send() does work fine. I will have another look, but I think it's not possible to implement the semantics of SendClass() in .Net.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Sendclass

Post by ecos »

Hi Chris,
yes, warning 618 is disabled. Can't remeber to have done this...
What I do is certainly a bit ugly, but sometimes it makes sense in my code to skip the super:method and call super:super:method.
Is there any chance to do this ?
User avatar
Chris
Posts: 4986
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Sendclass

Post by Chris »

Hi Karl,

There is a way, but is very complicated. Reflection (the mechanism used by Send() and late binding in general) can't do it, it's designed to always respect the inheritance rules. Only way I am aware of is to create dynamic IL code to do that, but this can be extremely difficult to implement correctly, especially if there are different method signatures involved.

Can you show some of your method declarations? Those that you may call with SendClass() I mean. If they are all standard untyped methods like usually done in VO, it will be a little easier to implement it. But if they are strongly typed, absolutely no way, sorry!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Sendclass

Post by ecos »

Hi Chris,
then it makes definitely sense to review my VO-Code. I should certainly be able to find other solutions. Ages ago it seemed to be the easiest way and it worked for years. I'll be back, if I have severe problems with the changes...
User avatar
Chris
Posts: 4986
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Sendclass

Post by Chris »

Hi Karl,

Yeah, a redesign in this particular area sounds like the best solution. If it turns out too be too difficult as well, maybe just give a sample of your methods and we'll have a look if it is possible to create a custom solution for those cases. But, yeah, a general all around solution is way to complicated unfortunately.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4567
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Sendclass

Post by robert »

Karl,

The SendClass() function is marked with an Obsolete attribute. You should have a warning that this function is Obsolete.
Maybe you did not look at the compiler warnings ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Sendclass

Post by ecos »

Warning 618 was disabled. I have now enabled it and a lot of work...
Post Reply