On 7/14/06, David Green <[EMAIL PROTECTED]> wrote:
On 7/13/06, Yuval Kogman wrote:
>So, Larry assisted by Audrey explained the purpose of === vs eqv vs =:=.
>It makes sense now, but I still feel that as far as ergonomics go
>this is not perfect.
I think I understand it... (my only quibble with the syntax is that
=== and eqv look like spin-offs of == and eq, but I don't know what
to suggest instead (we're running short of combinations of = and : !))
So there are three basic kinds of comparison: whether the variables
are the same (different names, but naming the same thing); whether
the values are the same (deep comparison, i.e. recursively all the
way down in the case of nested containers); and in-between (shallow
comparison, i.e. we compare the top-level values, but we don't work
out *their* values too, etc., the way a deep comparison would). If
I've got it right, this is what =:=, eqv, and === give us,
respectively.
It may well be that I'm misunderstanding here -- I've been away from Perl
development for too long and have a lot of catching up to do -- but I'm
uneasy about using the terms "shallow comparison" and "immutably equal" to
describe the same thing. If the "true meaning" of $a === $b is that
$a.id eq $b.id, where .id is the value for a "simple" type, I think it'd be
least confusing to just call it a shallow comparison. "Immutable equality"
sounds more like a promise of deep and lasting equality, not an assertion
that equality is skin deep. I make a similar inference from the long sigil
-- it has more the flavor of "more equal" than "a special case of equal" (to
me, at least). Just to muddy the waters further, I'd think -- off the cuff
-- that you might do well with expectations to say
== and eq - shallow comparison of numeric and string values, specifically
(with other types being
free to specify what their numeric and string values
are -- caveat usor)
Matches existing expectations of these operators
=== - deeply equal (equivalent to the current eqv); alias for
"isreally" or "isdeeply"
Expectation based on extending the == metaphor
eqv - Different names for the same thing (what I think =:= means
now)
Expectation based on glossing as "equivalent" rather
than "equal value".
=:= - Defined identically, with no promise about contents (what
I think === means now).
Expectation based on the use of : to indicate
declaratory behavior
Just two cents from a Perl6 newbie.
--
Regards,
Charles Bailey
Lists: bailey _dot_ charles _at_ gmail _dot_ com
Other: bailey _at_ newman _dot_ upenn _dot_ edu