develooper Front page | perl.perl5.porters | Postings from December 2017

[perl #132557] improvements in perldata

From:
James E Keenan via RT
Date:
December 28, 2017 22:36
Subject:
[perl #132557] improvements in perldata
Message ID:
rt-4.0.24-8638-1514500561-674.132557-15-0@perl.org
On Tue, 19 Dec 2017 18:19:37 GMT, jkeenan wrote:
> On Sun, 10 Dec 2017 04:36:21 GMT, calestyo@scientia.net wrote:
> >
> > This is a bug report for perl from calestyo@scientia.net,
> > generated with the help of perlbug 1.40 running under perl 5.26.1.
> >
> >
> > -----------------------------------------------------------------
> > Hi.
> >
> > perldata describes quite a lot about slices, list assignments and
> > that
> > like.
> >
> > I think it misses the following things (or could clarify on them):
> >
> >
> > 1) It tells what happens when one does a list assignment in scalar
> > context,
> >    e.g.:
> >    $count = $string =~ /\d+/g;
> >
> > At the same point it should also tell, what happens for list
> > assignment
> > in list context.
> >
> >
> > 2) It tells that a list evaluated in scalar context, evaluates all
> > it's
> >    elements (actually this is IIRC only mentioned in perlop) and that
> >    the last element get's assigned (all others discarded).
> >
> > I think it could also tell that this is the case for list slices,
> > e.g.
> > $b = (1, 2, 3, 4)[0, 3];
> > now b is 4
> > While this is still kinda "obvious" or what one could expect, the
> > following
> > is not necessarily so clear:
> > @a=(1, 2, 3, 4);
> > $b = @a[0, 3];
> > now b is four as well.
> >
> > AFAICS, it tells no where, that this would happen for array slices.
> > A reader may likely assume, that an array slice behaves like or is
> > an array and should thus - in scalar context - return the lenght.
> >
> > Actually it seems that slices generally behave more like lists than
> > like arrays, e.g. in the case of:
> > @colors{'red','blue','green'} = (0xff0000, 0x0000ff, 0x00ff00);
> > where the left hand side is not evaluated like an array, but like a
> > list
> > where one can assign to the elements of it.
> >
> > I think this (that slices are like lists) should perhaps be
> > emphasised
> > more.
> >
> > What about hash slices?
> >
> >
> 
> I've read this ticket several times.  Each time my impression has been
> "this ticket is all over the place".  It is very diffuse in its
> complaints.
> 
> I'm inclined to reject it unless the original poster can provide
> patches to the pod/*.pod files of concern.
> 
> Thank you very much.

No patches submitted, so closing as per previous notice.

Thank you very much.
-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132557



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