lua-users home
lua-l archive

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




On Tuesday, April 22, 2014, steve donovan <steve.j.donovan@gmail.com> wrote:
On Tue, Apr 22, 2014 at 1:57 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> 2: Lua the libraries that are critical, but not especially Lua related (os,
> math, io, ??). (Not sure where debug belongs. I think in the first grouping,
> along with Lua).

Well, most of these have fine existing C implementations, leaving some
bits which could be done in pure Lua.  But is there anything concrete
to be gained by moving existing functionality into Lua code and making
that straightforward build rather more icky and fragile?

I didn't mean to make it sound like any of this has to do with rewriting anything in Lua or really rewriting very much of anything at all. 
 

> that the flavor of random is not defined, so the library could be extended
> with a more robust random method and still be considered "Reference
> Compatible."

I'm officially in two minds about this now.  It seems harmless enough
- the new function obeys the correct contract - but then becomes more
difficult to audit the code.  It feels best (particularly in this
case) to keep the new PRNG explicit in its own namespace.

Tempting to extend math.max - but it breaks the basic contract of math
(functions that just work on plain numbers).  Better (again) to
namespace it.

(My starting point is that people use static analysis to understand
programs, from years of using a language, and subtly changing the
furniture will lead to confusion and stubbed toes)


Right. This the part that would need the most scrutiny. In terms of spelling out where standard libraries are "intentionally minimalistic and open to extension" or not, it might be best to do next to nothing, at first. 

The small bit of adjustment is about creating a clearly line between some of the libraries, in hopes of creating future flexibility, without bloating Lua for people that need it as small as possible. 

But I can see a set of dangers in this, too...

-Andrew