develooper Front page | perl.perl6.language | Postings from August 2006

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

Thread Previous | Thread Next
August 15, 2006 07:36
Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained
Message ID:
David Green writes:

> On 8/13/06, Smylers wrote:
> > Please could the proponets of the various behaviours being discussed
> > here share a few more concrete examples ...
> OK,

Thanks for that.  In summary, if I've understood you correctly, it's

  =:=  two aliases to the same actual variable
  ===  one variable contains a copy of the other's actual contents
  eqv  both contain contents which represent the same thing but may have
       come from different sources

And that being true at one level implies being true for the above
levels.  Yes?

> ===
> Example: Suppose I have some employee objects, and I employ two John 
> Smiths.  They have the same name, work in the same department, and by 
> stunning coincidence everything my class knows about them just 
> happens to be the same.

Except that they wouldn't.  Because each one would have a separate
payroll number, or some artificial thing invented just for the sake of
being different.  So this example doesn't sound plausible to me.

> But they're still different objects (the payroll system definitely
> needs to produce two cheques, although since they earn the same
> salary, it doesn't matter which one of them gets which cheque); so
> $john1 !=== $john2, and I can tell them apart.

And why on earth would you be making such a comparison?  If you have a
list of employees who need cheques then you just iterate through them
and process them in turn; you wouldn't be comparing an arbitrary pair of

So I now understand what this operator does.  But I'm still struggling
to fathom where I would ever have a use for it.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About