Comparing latex using "=" is dangerous!

for some reason when I’m using latex error handling there’s now an error message that’s generated (and a CL warning) to the tune of

Comparing latex using "=" is dangerous!

So, two things here. No, it’s not dangerous, and no, it’s not an error either.

Could this functionality kindly be rescinded? Not sure when this change was made but it’s not helpful and is in fact misleading.

There are some discussions and things in the works in this regard. Agreed that it is not “dangerous”, but may result in unintended behavior.

For clarity, currently latex that is invalid math input (i.e. something that would trigger an error in the calculator), even when compared to the exact same input, will result in the comparison returning false. For example, this will return false, which feels wrong.

testComparison = `5x=` = `5x=`

I’ll pass along your shared concern about the confusion to users. Thanks for bringing this up!

Yeah so sometimes we really do want an exact latex comparison, i.e. an expression(and I can’t think of any situation where we’d want to compare an incomplete equation as per the example you’ve given but be that as it may…).

With that in mind, how are we intended to do exact latex comparisons without triggering a false error as now occurs? Given the newly invented error message I can only assume there must be some other intendend method?

Agreed! Partially why this error message change occurred was my noting a situation where I wanted to compare initalLatex so that it didn’t throw an error, and noted this false latex comparison would be unexpected behavior for most external users.

That said, the comparisons that do work are string to string and string to latex:

testComparison1 = "5x=" = "5x="   #results in true
testComparison2 = "5x=" = `5x=`   #results in true
testComparison3 = `5x=` = `5x=`   #results in false

I’m hoping the 3rd’s behavior gets changed as the reasoning for its current state would be lost on the general user.

Problem being that some inputs are formatted to accept particular data types, there being a difference between rendering as string vs latex.

This error change will result in a lot of activities throwing errors(incorrectly). it’s not good.

Agreed. This is where testComparison2 may be the way to go. The input can be the latter latex, but the expected can be a string. For example:

correct = "\frac{1}{2}=\frac{2}{4}" = this.latex

suffix: when correct "✅" otherwise ""
correct: correct

But again, more intuitive if testComparison3 actually worked.

Either way there’s still an error message thrown now where there shouldn’t be.

I really don’t understand the purpose of this. i author a lot of activities for other people and trying to explain to them that today’s error message is actually fine when there wasn’t one yesterday is… well it doesn’t exactly imbue confidence.

100% agree. The error message may be quickly fixed. The functionality a bit more slowly.

1 Like