[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Moonscript as a useful notation for Lua users
- From: Javier Guerra Giraldez <javier@...>
- Date: Mon, 12 Aug 2013 13:27:27 -0500
On Mon, Aug 12, 2013 at 12:15 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
> On Mon, Aug 12, 2013 at 5:58 PM, Javier Guerra Giraldez <javier@guerrag.com>
> wrote:
>>
>> - while I don't hate significant whitespace, it usually makes it hard
>> to write full lambdas.
>
>
> There I don't follow you. The function body may be indented, and the
> returned value is the value of the last statement/expression...
compact lambdas are great for passing one-liners as function
arguments, but if you need indentation to write a two-liner, then you
have two different syntaxes for defining functions.
at worst you get Python, where functions _have_ to have a name, and
lambdas are limited to a single expression, no middle ground
(two-liner? give it a name!)
how is it done in MS? you can choose between single-expression,
delimited and indented syntaxes? that doesn't sound like a way to
simplify things...
>> - terseness at the cost of readability is ok for low level languages
>> (hey, I _like_ bit-twiddling in C), but for scripts it creates more
>> friction between coder and maintainer.
>
>
> Sometimes these are not different people, just the same person in different
> modes ;) But why should this argument not also apply to low-level
> languages? Also, the Modest Proposal involves a more informal & private use
> of a terse dialect - we do not _usually_ save our bash sessions to Github.
while reviewing low-level code you'e supposed to be paying attention
to every character, so terseness is not only tolerated but sometimes
preferred.
but you're totally right, there's no need to maintain one-off code
only used in a REPL
>> - local by default?... i'm skeptical that it could be done well.
>
> I share your skepticism on this one, especially for bigger systems.
>
>>
>> - predefined OOP: i don't mind it as long as it's easy to use (and
>> extend) from real Lua.
>
>
> It isn't even necessary. I could define a perfectly adequate 'class' in
> Moonscript in under 30 lines of code, and I knew it would then interoperate
> with the style I'm accustomed to. The built-in one basically establishes
> yet another OOP style that doesn't play so nice with other Lua OOP styles.
ok, it's unecessary, but if it's there, it will be used. case in
point: i was seriously considering to use Lapis, because the generated
Lua code seems mostly sane. but many of its structure is in the form
of MS classes. if they're not easy to use in Lua, then it's useless
to me.
>> - i guess a prerequisite to using it as a "more comfortable for REPL"
>> dialect of Lua would be a _very_ low mismatch between both languages.
>> so that the user finds writing in MS easier even if still thinks in
>> Lua (because most of the system is still written in Lua). if that's
>> right, anything beyond plain text substitutions and some syntax sugar
>> would increase the impedance and force a "mind context switch" between
>> REPL conversation and core programming.
>
>
> That puts it in a nutshell, basically. If there was a semantic gulf then it
> would defeat the purpose. All the important stuff is the same; there's a
> very compact function syntax, and the precedence of a function call is very
> low. Otherwise it's tables all the way down ;)
ok, so it's Lua + compact lambdas + easy to call complex
expressions... it does sound nice, as long as other features don't
spoil the good parts.
--
Javier