lua-users home
lua-l archive

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


On Sat, Apr 25, 2009 at 9:23 PM, David Manura <dm.lua@math2.org> wrote:

> However, consider the approach in Chapter 16 of Lua Programming Gems
> used to implement a matrix type (p.180).  All operations (even map)
> are in-place, like Python list methods.  However, there is an explicit
> copy() method, and all operations return the object itself to allow
> chaining.
>
>  -- two different uses
>  return a:copy():emwul(b):linfold()
>  return a:emwul(b):linfold()
>
> This is flexible and avoids excessive temporary copies.

They actually named this Fluent interface:
http://www.martinfowler.com/bliki/FluentInterface.html

-- 
Bertrand Mansion
Mamasam