using the Extended Method 'Union' ... help ?

This forum is meant for anything you would like to share with other visitors
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

using the Extended Method 'Union' ... help ?

Post by robert »

Phil,

These is a topic X# keywords in the help file. (Under X# Language Reference)

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

using the Extended Method 'Union' ... help ?

Post by Phil Hepburn »

Okay Robert,

Thanks, I have all the documentation sufficient for the moment, and a bit more perhaps ;-0)

Tomorrow is another day - now the soccer, Man United trying to get to the final round of the League Cup.

Cheers,
Phil.
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

using the Extended Method 'Union' ... help ?

Post by Phil Hepburn »

Okay Robert,

Thanks, I have all the documentation sufficient for the moment, and a bit more perhaps ;-0)

Tomorrow is another day - now the soccer, Man United trying to get to the final round of the League Cup.

Cheers,
Phil.
Frank Maraite
Posts: 178
Joined: Sat Dec 05, 2015 10:44 am
Location: Germany

using the Extended Method 'Union' ... help ?

Post by Frank Maraite »

Hi Robert,

is there really no better solution for that kind of issues?

The word 'union' is clearly used as a method call. Why does it conflict with a reserved word? Should the error message say more about this reason?

Many reserved word are the cost of the verbose XBase language, but leads to issues like this.

Frank
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

using the Extended Method 'Union' ... help ?

Post by Phil Hepburn »

Hi Frank, Chris and Robert,

Particularly since it is only the second occurrence of 'Union' which causes an issue.

See attached image :-
ChrisUnion_41.jpg
ChrisUnion_41.jpg (24.3 KiB) Viewed 521 times
Line 143 appears to work OK !?

And this is reinforced by the blue colouration only appearing on the second occurrence of 'Union' - see below :-
ChrisUnion_42.jpg
ChrisUnion_42.jpg (26.91 KiB) Viewed 521 times
This code does not compile.

I suppose I should have twigged (noticed) what was going on - BUT - because of an earlier case of LINQ query syntax not seeming to colour correctly in my version of VS 2017, I just got on with things and started to ignore all various colouration of the text and command words.

For some reason the current pre-compiler seems to see the two Unions in a different light / way.

Any sort of improvement will certainly be a help - I realise you are juggling a lot of balls in the air, but then you and the Team are 'Magic' !!!! So that's what we expect ;-0)

Cheers,
Phil.
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

using the Extended Method 'Union' ... help ?

Post by robert »

Frank Maraite wrote:Hi Robert,

is there really no better solution for that kind of issues?

The word 'union' is clearly used as a method call. Why does it conflict with a reserved word? Should the error message say more about this reason?

Many reserved word are the cost of the verbose XBase language, but leads to issues like this.

Frank
Some reserved words are also allowed as identifier. Union is not. At this moment UNION is in our 'VO keywords' list which is not allowed as identifier. You will have to prefix Union with @@ to make this work.,

I will move Union to the list of keywords that can be used as identifier, as well as Event (which is often used in VO event handler code).
Any other suggestions ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

using the Extended Method 'Union' ... help ?

Post by wriedmann »

Hi Robert,
I will move Union to the list of keywords that can be used as identifier, as well as Event (which is often used in VO event handler code).
Any other suggestions ?
I would like INSTANCE and maybe FIELD, if possible.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Otto
Posts: 174
Joined: Wed Sep 30, 2015 6:22 pm

using the Extended Method 'Union' ... help ?

Post by Otto »

Robert van der Hulst wrote:Some reserved words are also allowed as identifier. Union is not. At this moment UNION is in our 'VO keywords' list which is not allowed as identifier. You will have to prefix Union with @@ to make this work.,

I will move Union to the list of keywords that can be used as identifier, as well as Event (which is often used in VO event handler code).
Any other suggestions ?

Robert
Does the problem disappear if the code is case sensitive? UNION as keyword, Union as method.
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

using the Extended Method 'Union' ... help ?

Post by robert »

Otto,
Otto Christiaanse wrote:
Robert van der Hulst wrote:Some reserved words are also allowed as identifier. Union is not. At this moment UNION is in our 'VO keywords' list which is not allowed as identifier. You will have to prefix Union with @@ to make this work.,

I will move Union to the list of keywords that can be used as identifier, as well as Event (which is often used in VO event handler code).
Any other suggestions ?

Robert
Does the problem disappear if the code is case sensitive? UNION as keyword, Union as method.
Yes case sensitivity would make things much easier.
However this problem will be solved anyway in the version of X# that will be released this week. I have moved the following keywords to the list of keywords that can also be used as identifiers:

ALIGN, CALLBACK, CLIPPER, DECLARE, DEFINE, DELEGATE, DIM, DOWNTO, DLLEXPORT,
ENUM, EVENT, FASTCALL, FIELD, FUNC, GLOBAL, IN, INHERIT, INSTANCE, INTERFACE,
OPERATOR, PASCAL, PROC, PROPERTY, SEQUENCE, STEP, STRICT, STRUCTURE, THISCALL,
UNION, UNTIL, UPTO, USING, VOSTRUCT , WINCALL

This may lead to confusion when typing, especially if you trust the colors inside the editor.
For example: if you start typing the keyword FUNC
func1.png
func1.png (4.73 KiB) Viewed 521 times

Then it will be black (identifier) but after you add the name of the function then it will become Blue
func2.png
func2.png (12.06 KiB) Viewed 521 times
Some keywords are difficult to be allowed as identifier, because they appear alone on a line and the parser will not know if the word TRY on a line means the beginning of a try statement or a variable with the name TRY.
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

using the Extended Method 'Union' ... help ?

Post by Phil Hepburn »

Well guys,

As ever, Robert is true to his word and version 2.9 of the compiler seems to solve my 'Union' problem / issue.

Take a look at what now compiles and runs in my developing LINQ app - line 179 is where the BIG change has occurred :-
RvdH_errors_21.jpg
RvdH_errors_21.jpg (36.35 KiB) Viewed 521 times
We no longer need a prefix of '@@' for 'Union', and we get no blue colouration either, which previously showed that the parser was seeing the second 'Union' as a keyword, rather than a method name.

Well done TEAM - onwards and upwards ............

Best regards,
Phil.
Wales, UK.
Post Reply