Add an option to support '==' between alpha and string variables
When writing code, it is a very common habit to use the '==' operator when wanting to do value comparison between variables. When working in Synergy, this operator is not valid for comparing alpha and string values. It would be great if there were a compiler option to enable this as a valid comparison operator between alpha and string variables. This would help reduce interruption in a common developer scenario.
https://synergex.com/docs/versions/v111/index.htm#lrm/lrmChap3Operators.htm#Relational%20operators
Now if the documentation is wrong, that also needs correcting.
11/11/2019 9:19 AM 1
We've been burned by this from time to time for some reason; I can't recall the exact scenario. The cases only show this issue; but I do not believe this is the one I am thinking of (From 8/17/2018):
Please find attached a toy solution that shows the following program in both Traditional and Synergy.NET
main
record
myAlpha,a10
proc
if(myAlpha == ^null)
begin
nop
end
myAlpha = 'blah'
if(myAlpha == ^null)
begin
nop
end
endmain
In Traditional Synergy this behaves as one would expect, at the start of the program the if logic returns true and we step into the condition statement, after assignment it is no longer true.
This just simply doesn't compile in Synergy.NET.
The problem is we have places in our Traditional Code base where this logic is used, and as we move more and more logic into Synergy.NET we will encounter this more and more often, mostly by developers who are not familiar with Synergy.NET.
Is this expected? Is this documented anywhere?
11/15/2019 2:55 PM 0
11/22/2019 8:33 AM 0
11/22/2019 3:30 PM 0
Right now ‘==’ between alphas is the equivalent to .eq. which only compares the characters up to the size of the smallest variable. e.g. “bass” would be equivalent to “basset” , “yo” equivalent to “yoyo” and “anystring” equivalent to “”. Whereas if either side of the argument is a string it will use the string comparison .eqs. which will match to the longest variable on both sides adding spaces to the end of the smaller variable(read performance hit) . Which means “face “ won’t be the same as “facet” or “row “ won’t be the same as “row “ (unless you trim the argument) and “wibble” wont be the same as “”.
In the case of if (myAlpha == ^null) the traditional compiler converts this statement to “if (.not.myAlpha)”. If you used a String variable it would be true if the string was not initialized. It doesn’t compile in Synergy .NET due to a bug in the .net compiler.
11/22/2019 10:51 PM 0