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:
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.
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:
> 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.