View mode: basic / threaded / horizontal-split · Log in · Help
August 01, 2002
Re: What's the Solution?
"Pavel Minayev" <evilone@omen.ru> wrote in message
news:CFN374600443827431@news.digitalmars.com...
> On Mon, 22 Jul 2002 18:04:08 +0800 "anderson" <anderson@firestar.com.au>
wrote:
>
> > What type of numbers does ClassInfo return? Will the algorithm need a
hash
> > table?
>
> classinfo property is not a number, it's a reference to ClassInfo object.
> But there's nothing wrong in using object references as hashtable keys. =)

One of my intentions is that it becomes easy to see if two handles are the
same type with:
   if (h1.classinfo === h2.classinfo)
August 01, 2002
Re: What's the Solution?
On Thu, 1 Aug 2002 02:54:15 -0700 "Walter" <walter@digitalmars.com> wrote:

> One of my intentions is that it becomes easy to see if two handles are the
> same type with:
>     if (h1.classinfo === h2.classinfo)

I wonder why you use ===, not == ? I mean, there is only one
ClassInfo object per class, so comparing references should do.
August 03, 2002
Re: What's the Solution?
"Pavel Minayev" <evilone@omen.ru> wrote in message
news:CFN374700122923032@news.digitalmars.com...
> On Thu, 1 Aug 2002 02:54:15 -0700 "Walter" <walter@digitalmars.com> wrote:
>
> > One of my intentions is that it becomes easy to see if two handles are
the
> > same type with:
> >     if (h1.classinfo === h2.classinfo)
> I wonder why you use ===, not == ? I mean, there is only one
> ClassInfo object per class, so comparing references should do.

=== does compare references!
August 03, 2002
Re: What's the Solution?
On Sat, 3 Aug 2002 11:37:11 -0700 "Walter" <walter@digitalmars.com> wrote:

>> > same type with:
>> >     if (h1.classinfo === h2.classinfo)
>> I wonder why you use ===, not == ? I mean, there is only one
>> ClassInfo object per class, so comparing references should do.
> 
> === does compare references!

Is it so both for arrays and objects?

By the way, I've looked at default Object.cmp() - compares
references as well. So it all doesn't really matter. =)
August 04, 2002
Re: What's the Solution?
"Pavel Minayev" <evilone@omen.ru> wrote in message
news:CFN374721026579514@news.digitalmars.com...
> On Sat, 3 Aug 2002 11:37:11 -0700 "Walter" <walter@digitalmars.com> wrote:
>
> >> > same type with:
> >> >     if (h1.classinfo === h2.classinfo)
> >> I wonder why you use ===, not == ? I mean, there is only one
> >> ClassInfo object per class, so comparing references should do.
> >
> > === does compare references!
>
> Is it so both for arrays and objects?

Yes.
Next ›   Last »
1 2 3
Top | Discussion index | About this forum | D home