lua-users home
lua-l archive

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


> > > Just for completion, the Sol version ;-)  (and some comments)
> > >
> > > methodTable2 = methodTable:class {  -- inherit methods from
> > [...]
> > This is a great approach.  Just cross your fingers that nobody ever 
> > removes the function class() from the method table!  :)
> 
> Please note that it's :class, a method from Super!

Ah, been a while since I've delved into Sol internals (and honestly, I
don't remember any of this).  I'll have to look closer.

> > methods(myTable).func2()
> 
> I consider methods() a low level function that shouldn't be 
> used for regular programming tasks.

If the :class support is there, then the use of methods() should be
limited.

> > myTable->methodTableFuncWithSelf()   -- Implicit self 
> passed through to
> > a method table function.
> >       Which is the same as:
> >            
> methods(myTable).methodTableFuncWithSelf(methods(myTable))
> > and
> >            methods(myTable):methodTableFuncWithSelf()
> 
> Uh, no ;-)   methods(myTable).methodTableFuncWithSelf(myTable)

My bad...

> Using shorter names:
>   a->x()   would be   methods(a).x(a)
> 
> [But using the colon for this looks much much better! SCNR ;-)]

Than the -> symbol?  Yep, it does.

Josh