lua-users home
lua-l archive

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


In message <20190531171653.d6be1e3c4cc1ce72a2039a1d@ryanfordwebdev.com>
          Ryan Ford <ryan@ryanfordwebdev.com> wrote:
> But maybe we can agree that the syntax feels "foreign" to the existing syntax.

Surely that is only because we are not used to it. I certainly think

function (myfile)
   local <toclose> f = io.open (myfile, "r")
   return f:read "*all"
   end

is snappier than

function (myfile)
   local f = io.open (myfile, "r")
   local s = f:read "*all"
   f:close ( )
   return s
   end

The __close event seems to me a logical extension of Lua's reflexive
capabilities. 

--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/