On 26.02.2012 05:01, Anurag Priyam wrote:
> [- CC: awes...@naquadah.org]
> [+CC: awesome-devel@naquadah.org]
> 
> 
> On Fri, Feb 17, 2012 at 10:24 PM, Uli Schlachter <psyc...@znc.in> wrote:
>> You might be interested in the following commit:
>>
>> commit 2216b6a341ddb840200ea85207f8a59a5b3d61a6
>> Author: Uli Schlachter <psyc...@znc.in>
>> Date:   Fri Feb 17 17:48:11 2012 +0100
>>
>>    gears.color: Add table-based color definitions
>>
>>    Signed-off-by: Uli Schlachter <psyc...@znc.in>
>>
>> The syntax is almost identical to what you proposed above. The only 
>> difference
>> is that I went with "type" instead of "gradient".
> [...]
>> -- @return a cairo pattern object
>> function create_png_pattern(file)
>> +    local file = file
> 
> Why do we write `local file = file`?  Aren't function arguments
> lexically scoped?

A quick test with /usr/bin/lua says "yes, they are local to the function".
However, once I acquired a bad habit, I don't easily get rid of it again. :-)

> [...]
> +    elseif type(col) == "table" then
> +        local t = col.type
> 
> `type` is a core Lua function.  I wonder if it is a good practice to
> use it is a variable name in our code.  Might it be a better idea to
> redefine the standard `type` as `__type` instead?

Uhm? Variable? Where? Also, if someone breaks lua by overwriting standard
functions, that's their bug and only half mine.

And if you mean "col.type":I don't think that really counts as a variable name.
I think there is no place in lua where there would be any ambiguity.
Still, if you think it should be changed, patches welcome. What should be used
instead of "type" for the type?
(cairo calls it "type", too, cairo_pattern_get_type())

Uli
-- 
"In the beginning the Universe was created. This has made a lot of
 people very angry and has been widely regarded as a bad move."

-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to