develooper Front page | perl.perl6.language | Postings from November 2010

Re: Packed arrays and assignment vs binding

Thread Previous | Thread Next
From:
Stefan O'Rear
Date:
November 13, 2010 11:55
Subject:
Re: Packed arrays and assignment vs binding
Message ID:
20101113195457.GA24970@localhost.localdomain
On Sat, Nov 13, 2010 at 06:09:00PM +0100, Jonathan Worthington wrote:
...
> With packed arrays, however, I'm less clear what they mean. Since
> the point of a packed array is compact storage, there's no chance to
> actually have containers. Thus does assignment to a slot in a
> compact array ever make sense? There's not a container to look up
> and store things in.
> 
> While I can happily convince myself that:
> 
> @x[0] := 1; # works, just sticks 1 into the appropriate location
> @x[0] = 1; # dies, can't assign when there's no container
> 
> Actually makes sense, I can also somewhat see users not liking it.
> So my questions are:
> 
> 1) What semantics would users expect? Is it OK to say "no, you can't
> assign" in this case?
> 
> 2) If proposing that both should work, what, roughly, would that
> look like at an implementation level?

I have already come up with exactly the same conclusion on my own.  +1

Also, given "my int $x", "$x := 5" should work, but not "$x = 5".

-sorear


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