|
Moonscript is definitely interesting -- unfortunately I'm one of those programmers with strong opinions about what feels 'right' and 'wrong'. I'm just not terribly in love with the languages that compile to other languages thing...This makes me [51%] happy for now :]local import =function (t, ...)require('debug')local pref, keysif select('#', ...) > 1 or (... ~= nil and type(...) == 'table') thenkeys, pref = ...elsepref, keys = ...endkeys = keys or {}pref = pref or ''if not next(keys) thenfor k in pairs(t) dotable.insert(keys, k)endendlocal new_env = setmetatable({}, { __index = _ENV })for _, k in pairs(keys) donew_env[pref .. k] = t[k]enddebug.setupvalue(debug.getinfo(1, 'f').func, 1, new_env)endimport(string, { 'reverse', 'rep', 'sub' },'s')print(sreverse('cat'), srep('donut', 5), ssub('abcdefg', 3, 6))
----------------I mean it's touching _ENV, so I'm not happy... but I got the frontend I wanted.On Tue, Nov 19, 2013 at 9:07 AM, steve donovan <steve.j.donovan@gmail.com> wrote:On Tue, Nov 19, 2013 at 10:44 AM, Sir Pogsalot <sir.pogsalot@gmail.com> wrote:I didn't see the response as particularly negative. Precisely because
> the community involvement with upstream is through this list and an overall
> attitude like this will probably hurt Lua in the long run. Or maybe I'm
> just moping.. ~
Lua is so carefully (and slowly) engineered, most of its fans require
a big leap in utility from any new feature. And yes, a lot of us do
find the extra _typing_ tedious but just suck it up (or get clever
like Sean). The reading I have no problem with, and my spell checker
will catch mistakes ;)
Every now and then I suggest people have a look at Moonscript, not
because I think it's _the_ future of Lua, but because it is _a_ future
of Lua - and it compiles to very straightforward Lua. There is your
import feature there, 'locals-as-default', list comprehensions, really
concise lambdas and just about every 'it would be nice' feature I've
seen on this list. So it's an opportunity to try see how they feel in
practice. tlr;dr: a lot more syntax, and gotchas about local scope -
not for the newbie.
Unfortunately, I am too busy to contemplate marriage proposals at the
moment but the thought is appreciated ;)
steve d.