develooper Front page | perl.perl5.porters | Postings from April 2018

Re: [perl #133021] Removed the word "discouraged" from threads'documentation

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
April 10, 2018 15:11
Subject:
Re: [perl #133021] Removed the word "discouraged" from threads'documentation
Message ID:
20180410151134.GE25122@iabyn.com
On Tue, Apr 10, 2018 at 10:26:21PM +0800, Tom Molesworth via perl5-porters wrote:
> On 10 April 2018 at 21:59, Dave Mitchell <davem@iabyn.com> wrote:
> > Can you come up with a hypothetical scenario, e.g.  a multi-threaded
> > program that uses libraries to connect to a database and retrieve and
> > parse some XML data. Then got through it step by step so that I can see
> > why using perl and CPAN is dangerous, but using (e.g.) java and a DB and
> > XML library is safe? What is the crucial difference between the two that
> > flips it from being safe to unsafe?
> >
> 
> Here's one trivial hacked-together example of code which I would argue
> leads to "unexpected" results, at least from the perspective of a C or Java
> programmer experienced in the ways of threads:

That isn't a reply to the asked question, which was trying to eke out an
understanding of why Christian believes the CPAN ecosystem in some way
makes threading more hazardous on perl than in other languages (which it
may, but I can't grasp the point he's trying to make).

The example code you've given seems to be (at a quick glance), just the
fact (again) that refs in different threads have different addresses in
perl.

Yes of course this will be confusing to anyone who expects the perl
threading model to be the same as C or Java's. And yes I agree that the
docs should explain the model  early on to manage expectations.

-- 
This is a great day for France!
    -- Nixon at Charles De Gaulle's funeral

Thread Previous | Thread Next


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