develooper Front page | perl.perl5.porters | Postings from October 1999

Re: perlthread.pod -- First draft of thread docs

From:
Dan Sugalski
Date:
October 26, 1999 04:54
Subject:
Re: perlthread.pod -- First draft of thread docs
Message ID:
3.0.6.32.19991026075246.00c716c0@tuatha.sidhe.org
At 10:54 AM 10/26/99 +0200, Matthias Urlichs wrote:
>Hi,
>
>Tuomas J. Lukka:
>> 
>> Actually, I think that maybe
>> 	$lock = lock $obj;
>> 	undef $lock;
>> would make a nice interface
>>
>That's somewhat nonintuitive, IMHO, because the current semantics of
>
>     foo();
>
>are identical to
>
>     {  my $bar = foo(); }
>or
>     my $bar = foo();
>	 $bar = undef;
>
>so the lock code would need some internal magic to determine whether its
>return value is going to be stored anywhere.
>
>Somehow I doubt that the current Perl core allows for this..?

Oh, sure. Check wantarray. It's undef in void context (like a plain lock
$foo) and false in scalar context. you can do it from within the core with
a quick macro check, though I don't remember which one at the moment.

Whether we want to do that or not is a separate question. 

					Dan

----------------------------------------"it's like this"-------------------
Dan Sugalski                            even samurai
dan@sidhe.org                           have teddy bears and even
                                        teddy bears get drunk



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About