Hello,
sometimes in VO I'm writing such code:
if ! cString1 == cString2
because
if cString1 != cString2
depends on SetExact(). Personally I would like an operator like "!==" to have an exact version of "!=" like "==" for "="
If there is already something similar, please ignore. And of course, it has absolutely no priority.
Wolfgang
exact string compare
exact string compare
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
exact string compare
Wolfgang,
In the core dialect afaik there is no difference between string = string and string == string.
Similarly string != string is the same as !(string == string).
We could add an operator !== and map it to the Core != operator for all dialects if you want.
That should not be too difficult.
Robert
In the core dialect afaik there is no difference between string = string and string == string.
Similarly string != string is the same as !(string == string).
We could add an operator !== and map it to the Core != operator for all dialects if you want.
That should not be too difficult.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
exact string compare
That would be very welcome! I will have a LOT of code in Vulcan and VO dialects in the future. New code is always written in Core dialect. And so I don't have to think about the dialect when working in older code.We could add an operator !== and map it to the Core != operator for all dialects if you want.
That should not be too difficult.
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
exact string compare
pmfji, that means, in core you can't (easily) compare substring with fullstring?Robert wrote:Wolfgang,
In the core dialect afaik there is no difference between string = string and string == string
Robert
Just had a go:
FUNCTION Start() AS VOID
LOCAL c1, c2 AS STRING
? "c1 = ", c1:= "a"
? "c2 = ", c2:="abc"
?"c1==c2: " ,c1==c2
? "c2==c1: ", c2==c1
?"c1=c2: " ,c1=c2
? "c2=c1: ", c2=c1
Return
the last two lines won't compile in core - "no such operator".
?
Karl
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
exact string compare
Hi Karl,
The partial string compare operator is not a compiler thing, it is implemented through a runtime function because its behavior depends on different things like the state of SetExact(), the type of the operands etc. The Core dialect has no runtime, so this operator is not supported.
Theoretically we could implement it at the compiler level in Core, but that would cause trouble like it would have different results than in the other dialects and also what would the "!=" operator mean then? Should it be the opposite of "=" or the opposite of "=="?. In VO the behavior of that operator is crazy, depending on the operands it some cases it means !(==) and in others !(=). It was obviously a big nightmare emulating the same behavior in vulcan for compatibility with VO.. The Core dialect is the "cleanest" x# dialect, so I think it's better leaving this feature out in this dialect.
Chris
The partial string compare operator is not a compiler thing, it is implemented through a runtime function because its behavior depends on different things like the state of SetExact(), the type of the operands etc. The Core dialect has no runtime, so this operator is not supported.
Theoretically we could implement it at the compiler level in Core, but that would cause trouble like it would have different results than in the other dialects and also what would the "!=" operator mean then? Should it be the opposite of "=" or the opposite of "=="?. In VO the behavior of that operator is crazy, depending on the operands it some cases it means !(==) and in others !(=). It was obviously a big nightmare emulating the same behavior in vulcan for compatibility with VO.. The Core dialect is the "cleanest" x# dialect, so I think it's better leaving this feature out in this dialect.
Chris
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
exact string compare
Hi Chris,
Therefore in VO I'm always writing
if ! cString1 == cString2
and I'm very happy that at least in the Core dialect this problem is solved.
Wolfgang
I couldn't agree more!In VO the behavior of that operator is crazy, depending on the operands it some cases it means !(==) and in others !(=).
Therefore in VO I'm always writing
if ! cString1 == cString2
and I'm very happy that at least in the Core dialect this problem is solved.
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
exact string compare
Karl,
You are right. The single equals operator does not work in the Core dialect for strings. We only support the double equals.
To compare a substring you need to use the String.Compare() method and pass it the start position and length that you want to compare.
Robert
You are right. The single equals operator does not work in the Core dialect for strings. We only support the double equals.
To compare a substring you need to use the String.Compare() method and pass it the start position and length that you want to compare.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
exact string compare
Wolfgang,
I have added the !== operator earlier today. It does what you asked for.
And I discovered that the != operator for Strings was not doing the same that the Vulcan operator did, but now it does: it calls a runtime function for its wok.
And the <> operator and the # operator do the same as the != operator.
Robert
I have added the !== operator earlier today. It does what you asked for.
And I discovered that the != operator for Strings was not doing the same that the Vulcan operator did, but now it does: it calls a runtime function for its wok.
And the <> operator and the # operator do the same as the != operator.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
exact string compare
Robert,
if there ist no behavioural difference of = and ==, i wonder why the "special" case == exists at all ?
if there ist no behavioural difference of = and ==, i wonder why the "special" case == exists at all ?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
exact string compare
Karl,
Compatibility, compatibility.
We have to support the difference between '=' and '==' for the VO and Vulcan dialect.
And like i said before: the '=' operator is NOT supported for strings in the Core language because it depends on a runtime function (which again depends on the SetExact setting)
Robert
Compatibility, compatibility.
We have to support the difference between '=' and '==' for the VO and Vulcan dialect.
And like i said before: the '=' operator is NOT supported for strings in the Core language because it depends on a runtime function (which again depends on the SetExact setting)
Robert
FFF wrote:Robert,
if there ist no behavioural difference of = and ==, i wonder why the "special" case == exists at all ?
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu