I’ve had several requests that an assertion based on #=== be added to
Test::Unit. While I think it’s a fine idea, I haven’t yet found a name
that seems to fit, so I thought I’d ask and see if anyone else can come
up with something decent.
I’ve had several requests that an assertion based on #=== be added to
Test::Unit. While I think it’s a fine idea, I haven’t yet found a name
that seems to fit, so I thought I’d ask and see if anyone else can come
up with something decent.
Maybe…
assert_case_equal
assert_not_case_equal
This comes from ri, which calls === “case equality”
squeaker% ri Object.===
------------------------------------------------------------- Object#===
obj === anObject → true or false
···
Case Equality---A synonym for Object#==, but typically overridden
by descendents to provide meaningful semantics in case statements.
Has a double meaning – case insensitive string compare, but I can’t
think of anything better.
I’ve heard this operator called the “threequal” operator.
I’ve also heard it called the “case equality” operator (since it is used
by ‘case’). I’m not sure if this is a good name, because /123/ ===
‘foo123’ has a truthful value, but I wouldn’t call /123/ and ‘foo123’
equal.
Paul
···
On Wed, Feb 12, 2003 at 12:05:05PM +0900, nathaniel@NOSPAMtalbott.ws wrote:
I’ve had several requests that an assertion based on #=== be added to
Test::Unit. While I think it’s a fine idea, I haven’t yet found a name
that seems to fit, so I thought I’d ask and see if anyone else can come
up with something decent.
On Wed, 12 Feb 2003 nathaniel@NOSPAMtalbott.ws wrote:
I’ve had several requests that an assertion based on #=== be added to
Test::Unit. While I think it’s a fine idea, I haven’t yet found a name
that seems to fit, so I thought I’d ask and see if anyone else can come
up with something decent.
irb(main):007:0> def assert_case_of(x,y); x === y; end
=> nil
irb(main):008:0> assert_case_of(String, “abc”)
=> true
I’ve heard this operator called the “threequal” operator.
I’ve also heard it called the “case equality” operator (since it is used
by ‘case’). I’m not sure if this is a good name, because /123/ ===
‘foo123’ has a truthful value, but I wouldn’t call /123/ and ‘foo123’
equal.
I think “case equality” is the common term for it.
That term bothers me for essentially the reasons
you mention – it isn’t really “equality.”
“Threequal” is cute. Never heard that one.
In TRW, I tended to say “relationship operator.”
That’s a little vague, and I can’t remember where
I heard it. I’m pretty sure I didn’t make it up.
Off the top of my head, I think “equivalence
operator” might be a good term. And I did make
that one up just now.
Hal
···
----- Original Message -----
From: “Paul Brannan” pbrannan@atdesk.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, February 12, 2003 9:24 AM
Subject: Re: Name for #=== based assertion
On Wed, Feb 12, 2003 at 12:05:05PM +0900, nathaniel@NOSPAMtalbott.ws wrote:
I’ve had several requests that an assertion based on #=== be added to
Test::Unit. While I think it’s a fine idea, I haven’t yet found a name
that seems to fit, so I thought I’d ask and see if anyone else can come
up with something decent.
I’ve heard this operator called the “threequal” operator.
I’ve also heard it called the “case equality” operator (since it is used
by ‘case’). I’m not sure if this is a good name, because /123/ ===
‘foo123’ has a truthful value, but I wouldn’t call /123/ and ‘foo123’
equal.
Hmm, I had ranged afield from the original topic.
I was talking terminology in general. I don’t
have an opinion on that method name.
Probably assert_case_equal would be more intuitive
to more people. But as I said, I don’t
really have an opinion.
Hal
···
----- Original Message -----
From: “Nathaniel Talbott” ntalbott@rolemodelsoftware.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, February 12, 2003 4:50 PM
Subject: Re: Name for #=== based assertion
Hal E. Fulton said:
Off the top of my head, I think “equivalence
operator” might be a good term. And I did make
that one up just now.
So you would suggest #assert_equivalent? It has a nice ring to it.
Objections?
Yes, since in English “equivalent” and “equal” are more or less
equivalent.
They may be equivalent, but they’re not equal. ;-)*2
Just kidding. I see your point.
From Webster’s Revised Unabridged Dictionary (1913) [web1913]:
Equivalent \Equiv"alent, v. t.
To make the equivalent to; to equal; equivalence. [R.]
This entry really confuses me. A transitive verb???
“A equivalents B.” Never heard the like before. Is there
an entry for the adjective?
But in all seriousness, I personally think that “equivalent”
carries a connotation different from “equal.” dictionary.com
(FWIW) says “something that is essentially equal to another.”
I sumbit they say “essentially” for a reason. They also say
“equal, as in value, force, or meaning” (but they don’t say
identity). Also: “having virtually identical or corresponding
parts.” (Note “virtually.”) However, in fairness, they also
say “Having similar or identical effects” where “identical”
implies more than similarity, but then they are talking about
the “effects” of the thing, not the thing itself.
Feel free to disagree. I promise I won’t respond if you
do, as the subject rapidly grows silly.
Cheers,
Hal
···
----- Original Message -----
From: “Matt Armstrong” matt@lickey.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, February 12, 2003 5:28 PM
Subject: Re: Name for #=== based assertion
Off the top of my head, I think “equivalence
operator” might be a good term. And I did make
that one up just now.
So you would suggest #assert_equivalent? It has a nice ring to it.
Objections?
Yes, since in English “equivalent” and “equal” are more or
less equivalent.
Well, yes… although if I saw #assert_equivalent, it would at least
make me go, “What’s the difference between that and #assert_equal?” Of
course, the fact that the name doesn’t immediately spell out what that
difference is is an immediate point against it…
Test::Unit should try to play on ==='s use in case
statements, or make something up. E.g. in Ruby source === is
called eqq:
Or #assert_eqq? While a bit bizarre, that does have the advantage of
being short, distinguishable and memorable.
At this point I’m debating between #assert_case_equal and #assert_eqq. I
like the former’s tie to the case statement, but dislike its
confusability with string case (upper or lower) and its length. Plus, it
just doesn’t flow for me. The latter, well, I guess I already spelled
out what I do and don’t like about it.
From Webster’s Revised Unabridged Dictionary (1913) [web1913]:
Equivalent \Equiv"alent, a. [L. aequivalens, -entis, p. pr.
of aequivalere to have equal power; aequus equal + valere to
be strong, be worth: cf. F. ['e]quivalent. See {Equal}, and
{Valiant}.]
1. Equal in wortir or value, force, power, effect, import,
and the like; alike in significance and value; of the same
import or meaning.
For now to serve and to minister, servile and
ministerial, are terms equivalent. --South.
2. (Geom.) Equal in measure but not admitting of
superposition; -- applied to magnitudes; as, a square may
be equivalent to a triangle.
(there is also a noun and a verb, but I don’t think either is what we’re
looking for).
Paul
···
On Thu, Feb 13, 2003 at 08:45:36AM +0900, Hal E. Fulton wrote:
----- Original Message -----
From: “Matt Armstrong” matt@lickey.com
From Webster’s Revised Unabridged Dictionary (1913) [web1913]:
Equivalent \Equiv"alent, v. t.
To make the equivalent to; to equal; equivalence. [R.]
This entry really confuses me. A transitive verb???
“A equivalents B.” Never heard the like before. Is there
an entry for the adjective?