develooper Front page | perl.perl5.porters | Postings from July 2011

Re: [PATCH] [DOCS] Modernize perlopentut.pod

Thread Previous | Thread Next
From:
David Golden
Date:
July 18, 2011 13:37
Subject:
Re: [PATCH] [DOCS] Modernize perlopentut.pod
Message ID:
CAOeq1c-x9h2iS7tVo-Yhkym7zG2r4NBbK8COGjuw0jyUoEzVEw@mail.gmail.com
On Mon, Jul 18, 2011 at 4:16 PM, Mike Doherty <doherty@cs.dal.ca> wrote:
> So, is there a reason to expend brainpower on knowing and assessing whether
> to use 2- or 3-arg open, or is 3-arg always suitable? If 3-arg is always
> suitable, then I'd like to hear the case for including 2-arg (and 1-arg!) in
> the tutorial. perlfunc should of course describe things as they really are,
> since it is a reference and not a tutorial.

People will encounter 2-arg open in the wild in other people's code.
For a tutorial, it's important to teach what else people might see
(and why not to blindly start using that same style).

As Tom points out, there is no problem with 2-arg open if *you*
control all the arguments and know what you're doing.  The rationale
for 3-arg open is (IMO) that it's less error-prone.

So I think using 3-arg primarily in at tutorial makes sense, as well
as including a section on 2-arg explaining under what circumstances
it's "safe" for use.

-- David

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