Original Authors and Naming of Functions

3 views
Skip to first unread message

steve donovan

unread,
Jan 31, 2011, 4:02:12 AM1/31/11
to lua-cookbo...@googlegroups.com
Hi all,

The lua-users wiki is full of nice stuff like this:

http://lua-users.org/wiki/StringRecipes

However, wikis are not the best way to track authorship. I copied a
number of wiki recipes to the snippets site:

http://snippets.luacode.org

but again, it's not easy to find original authors. (Besides, there is
a design flaw: the _submitter_ is seen but there's no field for
_author_).

I raise this because authorship and licence issues are important if we
aim to provide code that can be used freely.

Another point: there are going to be hundreds of little functions,
they will all need names. One approach is to use sufficiently long
names so that the meaning is clear, e.g. table_copy (that is the
approach taken on the snippets site); another is to come up with some
namespaces, e.g. xtable.copy.[1] (We probably all agree that putting
user functions into system tables like table.copy is a barbaric
practice, no matter how tempting it might be.)

Or cookbook.table.copy ? Not so bad if you say 'local tx = require
"cookbook.table"', which is now considered good style.

steve d

[1] tablex.copy is already in Penlight.

Alexander Gladysh

unread,
Feb 4, 2011, 5:43:29 PM2/4/11
to lua-cookbo...@googlegroups.com
Hi, all!

Apologies for prolonged silence. Hard two weeks with a conference and
a mild crunch.

On Mon, Jan 31, 2011 at 12:02, steve donovan <steve.j...@gmail.com> wrote:

> The lua-users wiki is full of nice stuff like this:

> http://lua-users.org/wiki/StringRecipes

> However, wikis are not the best way to track authorship.  I copied a
> number of wiki recipes to the snippets site:

> http://snippets.luacode.org

> but again, it's not easy to find original authors. (Besides, there is
> a design flaw: the _submitter_ is seen but there's no field for
> _author_).

> I raise this because authorship and licence issues are important if we
> aim to provide code that can be used freely.

For trivial code that can't be attributed: rewrite it. If it is too
trivial to rewrite, it is hardly copyrightable.

For less trivial code which can't be rewritten: maybe we can add a
link to the Wiki with some attribution text?

> Another point: there are going to be hundreds of little functions,
> they will all need names. One approach is to use sufficiently long
> names so that the meaning is clear, e.g. table_copy (that is the
> approach taken on the snippets site); another is to come up with some
> namespaces, e.g. xtable.copy.[1]  (We probably all agree that putting
> user functions into system tables like table.copy is a barbaric
> practice, no matter how tempting it might be.)

> Or cookbook.table.copy ?  Not so bad if you say 'local tx = require
> "cookbook.table"', which is now considered good style.

Um. IMO, examples in a book should not have namespaces — it will harm
readability.

OTOH, examples in the files, supplied with the book should be put into
a namespace, so they will be reusable.

Alexander.

Reply all
Reply to author
Forward
0 new messages