lua-users home
lua-l archive

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


On Mon, Sep 12, 2011 at 01:12:47AM +0200, Lorenzo Donati wrote:
> Yes, that's the same feeling I have by default. But the idea to exploit 
> such a feature came to me just from the behaviour of some library 
> functions, which *do* make a difference:
> 
> --------------------------------------------
> local function f() return end
> local function g() return nil end
> 
> assert( f() )  --> bad argument #1 to 'assert' (value expected)
> assert( g() )  --> assertion failed!
> 

> table.insert( t, f() )  --> wrong number of arguments to 'insert'
> table.insert( t, g() )  -->ok
> 

In both cases, the behaviour seems not to be planned for, but 
not sufficiently obnoxious to justify testing for it.

> So even if I agree it is a subtle difference, the fact that the 
> difference is exposed through the library seems to suggest that it is a 
> legitimate technique.
> 

The fact that a doctor treats certain conditions by injecting cocaine
does not mean that everybody can legitimately do so.

Dirk