lua-users home
lua-l archive

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

On 06/09/2017 09:18 PM, Dirk Laurie wrote:

> 1. What will our 'require' return? A function? A table? A userdata?

Function if it exports sole function. Table if exports object or
set of functions.

> 2. Do we locally cache predefined globals?

If it is really (at least 1%) improves final performance.
Or if we wish nicer names for globals.

> 3. How do we code sentinel objects (i.e values that like nil are
> guaranteed not to be equal to anything else)?

Usually "{}". But it was noted it is not secure - you may store
sensitive information in that sentinel table. Other way is
"function() end".

> 4. Do we make big do ... end blocks in our code in order to
> restrict the scope of locals?

Yes if it improves code understanding.

> 5. Do we use some sort of Hungarian notation (i.e. CamelCase,
> quick_brown_fox etc) that advertises what the name will be
> used for)?

Almost no. But "is"/"has" prefix for booleans is nice. And plural
names for arrays/tables ("items").

Words concatenation method in variable names is purely
project-dependent choice. Some prefer oneHumpCamelCase, CamelCase,
vanilla_c, of luastyle ("isyieldable").

> 6. Do we consciously conform to ldoc rules for comments?

May not, unless you are Steve Donovan.

-- Martin