lua-users home
lua-l archive

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


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
------------------------------------------------------------------------