[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: use of gettop to change functionality
- From: liam mail <liam.list@...>
- Date: Tue, 1 Mar 2011 11:40:50 +0000
I would personally say that table.insert(t,1,k) and table.insert(t,k,nil) under Lua rules should behave the same. The problem is the function is doing too much and would require a separate C function which I do not think is going to happen. The biggest problem I see with tinsert is that extra parameters ie greater than three cause an error, are there any other Lua C functions that do not ignore extra parameters?
On 1 March 2011 11:30, Gunnar Zötl <firstname.lastname@example.org>
Is there a source for that claim? I'd reckon that the most frequent use of these is to do optional/variable arguments, and checking wether you got the correct number of arguments. At least that's what I do with those.
> The most frequent use of gettop and isnone in C lua libraries to
> modify what a function does really disturbs me.
Nope, it should not. Passing three nils is not the same as passing nothing at all.
> foo(nil,nil,nil) should be the same as foo(nil,nil) and foo() etc
Could you name a few, please?
> What steps can we take to discourage the writing, and usage of libraries that do such evil?
Actually Daurnimator does have a valid point, which maybe should require a note to the functions it effects.