Re: [RFC] Stringify a thread

[email protected] ("Joshua ben Jore") Thu, 5 Oct 2006 10:58:04 -0500
Newsgroups perl.perl5.porters,perl.ithreads
Message-ID <[email protected]>
On 10/4/06, Jerry Hedden <[email protected]> wrote:
> I'm considering a one line addition to the threads module to overload
> the string value of a thread to return its ID:
>
>   '""' => sub { shift->tid() }
>
> Since thread IDs are unique, thread objects could be used as hash keys
> in a more rational way:

Better would be letting the stringified object still look like a
stringified object. Perhaps you add your info on the end like C<<
',tid=' . $obj->tid  >>. I get a lot of mileage out of noticing what
things look like when printed. It's unusual when an object doesn't
stringify to something to that looks like an object.

Josh