lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 02, 2012 at 09:35:58AM -0400, Louis Mamakos wrote:
> 
> On Apr 2, 2012, at 9:23 AM, Rob Kendrick wrote:
> 
> > On Mon, Apr 02, 2012 at 10:10:36PM +0900, Miles Bader wrote:
> >> Rob Kendrick <rjek@rjek.com> writes:
> >>>> On Mon, Apr 2, 2012 at 11:47 AM, Rob Kendrick <rjek@rjek.com> wrote:
> >>>>> foo = t[1, 2, 3] -> __slice(t, 1, 2, 3)
> >>>> 
> >>>> Just to check the intended meaning; t[1,2,3] gives you {t[1],t[2],t[3]} ?
> >>> 
> >>> No.  There is no intended meaning.  One could write a __slice function
> >>> that did this, though.
> >> 
> >> If there's no intended meaning, then the term "slice" is unnecessarily
> >> confusing/misleading.
> >> 
> >> Why not just call them "__multi_index" (or "__mindex") etc; boring, but
> >> at least obvious extensions of the existing terms ("just like index,
> >> only with multiple indices").
> > 
> > The word was selected at the beginning of the discussion on IRC, and not
> > changed at the end.  I advocate no specific naming.  Except perhaps
> > __plinth, because it sounds nice :)
> > 
> > (Please don't CC me :)
> > 
> > B.
> > 
> 
> Is the mechanism thought to be limited to exactly 3 arguments to the metamethod?  Could it be generalized to 2 or more "subscripts"?

Good question.  Two options:
	1. subscripts >= 2
	2. subscripts ~= 1

B.