I think if you step back, you can ask what the purpose of an error message
is and who designs it.
Is the message for the developer or others on their team or something an
end-user knowing nothing about R will see.
This reminds me a bit of legal mumbo jumbo that turns many reading it off as
it keeps talking about the party of the first part or the plaintiff as
compared to somewhat straighter talk.
The scenario is that you are comparing two things. Their names are not
things like "target" or "current" so even other programmers
not involved in
your code will pause and wonder.
One view is to use phrases like first and second arguments/lists/whatever.
You might talk about the one on the left (but using LHS is a bit opaque)
versus the one on the right.
But sometimes it can be too verbose. Sometimes the error message is being
generated not where everything is clear.
So ideally you could say:
WARNING Danger Will Robinson.
Comparing two things for equality.
Result finds mismatches.
There were NA found on the (left or right) that were not matched on the
other side.
Number of such found: 2
If you had a Systems Engineer write detailed requirements that included
something a bit better than the example and the programmer was able to
supply the data using the words and guidelines, it might fit some needs but
maybe not satisfy other programmers. But there are human factors people
whose job it is to help choose among alternatives and although they may not
choose well, letting a programmer come up with whatever they feel like is
generally worse.
Yes, in their microcosm centered on a dozen lines of code, "current"
and
"target" may have meaning. But are they the intended user of the
product?
-----Original Message-----
From: R-devel <r-devel-bounces at r-project.org> On Behalf Of Antoine
Fabri
Sent: Thursday, March 2, 2023 12:23 PM
To: peter dalgaard <pdalgd at gmail.com>
Cc: R-devel <r-devel at r-project.org>
Subject: Re: [Rd] confusing all.equal output
Good points. I don't mind the terminology since target and current are the
names of the arguments. As the function is already designed to stop at the
first failing check we might not need to enumerate or count the mismatches,
instead we could have "`NA` found in `target` but not in `current` at
position <FIRST_MISMATCH>"
[[alternative HTML version deleted]]
______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel