[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Idea: Reference Libraries
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 22 Apr 2014 14:11:03 +0200
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?
> 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)