[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Microlight
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 17 Dec 2012 19:18:16 +0200
2012/12/16 steve donovan <steve.j.donovan@gmail.com>:
>
> http://stevedonovan.github.com/microlight/
>
I've had a fresh look (first time since May), and one thing
that now glares is that the Array type is not integrated as
completely as it might be.
1. There is no need to have functions in `ml.Array`
visible under the same or (worse) other names
in `ml`. The extra convenience is not worth using
up a name for. Any sane user is going to import
the routines to _ENV or assign them to locals.
2. Many non-Array functions return Array anyway. It's
confusing that some don't. They should all do so.
Therefore, I suggest removing the following functions from
`ml` itself:
ifilter, sub, indexby, range, indexof, ifind, extend, imap,
imap2
keeping only the Array versions. To compensate for that,
add a method Array:table that simply sets the metatable
back to nil. E.g.
ml.split"the quick brown fox":table()
is just a table, not an Array.
We now have at least nine extra slots (I may have missed
some omissible functions) available for the various wish
lists discussed on this list in May. IIRC mine was for a wrap
function to complement split:
wrap(src[,re[,linelength[,sep]]])
Join using `sep` an array of strings `src` such as that
returned by `split` into strings not longer than `linelength`.
If `src` is a string, replace it by `split(src,re)`.