[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pairs(t, skey) and ipairs(t, skey)
- From: "Joseph Manning" <manning@...>
- Date: Wed, 2 Oct 2013 15:59:53 +0100
On 2013-Oct-02 (Wed) at 01:27 (-0700), Tim Hill wrote:
>> I'm stunned that you can seriously suggest
>> "honors the contract with you to use only sequences".
Tim,
I agree that a fast and easy 'table.issequence( t )' would be
very welcome, but if there was a fast and easy way to implement it,
I'm sure the Lua developers would have long ago thought of it.
For validating its arguments, how far should a function go?
At some point, it seems practical or even necessary to trust them.
For example, if a function expects a sequence of prime numbers
as argument, should the function actually run a primality algorithm
to re-check that each number is indeed prime?
Or a function that expects the adjacency lists of a planar graph;
should it run a full planarity algorithm to re-check that the graph
is indeed planar?
Maybe there are situations where the answer to such questions is yes,
but perhaps in many other situations, there's a point at which the
arguments should be trusted, and GIGO rules.
Joseph
------------------------------------------------------------------------
Joseph Manning / Computer Science / UCC Cork Ireland / manning@cs.ucc.ie
------------------------------------------------------------------------
- References:
- Re: pairs(t, skey) and ipairs(t, skey), Dirk Laurie
- Re: pairs(t, skey) and ipairs(t, skey), Paul K
- Re: pairs(t, skey) and ipairs(t, skey), Luiz Henrique de Figueiredo
- Re: pairs(t, skey) and ipairs(t, skey), Tim Hill
- Re: pairs(t, skey) and ipairs(t, skey), Luiz Henrique de Figueiredo
- Re: pairs(t, skey) and ipairs(t, skey), Tim Hill