[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Slicing ideas
- From: Rob Kendrick <rjek@...>
- Date: Mon, 2 Apr 2012 20:29:47 +0100
On Tue, Apr 03, 2012 at 12:54:34AM +0800, Alex Davies wrote:
> So..
>
> Just playing with this thought experiment, what does t[f()] do?
> Multiret into a __slice, falling back into an __index with the first
> return (or nil if none) if not found?
>
> Sounds messy on the vm. Or does it truncate to one argument and just
> call __index?
This is why I brought the discussion here; there are complexities.
> I'm not sold on the idea personally. I'd rather __index, __newindex
> were expanded to support multiple arguments if anything is to be
> done.
>
> Once you do that though, It's a bit how deep does the rabbit hole
> go? ie can you return multiple values from __slice? Can you assign
> multiple values to __newslice?
>
> ie would you want this to be able to be made to work:
>
> t[1,3] = 3,4,5
No. There's only one item on the LHS, but many on the RHS. Same rules
apply.
B.