lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 23, 2012 at 9:25 AM, Robert Klemme
<shortcutter@googlemail.com> wrote:
> On Mon, Apr 23, 2012 at 1:24 PM, Rena <hyperhacker@gmail.com> wrote:

>> I've always wanted to see an "OS" written in Lua, which in reality
>
> It's interesting to see this type of discussion: over there in the
> Ruby community it came (or: comes) up from time to time, sometimes in
> the variant of wanting a Ruby shell (note: there is already IRB, pry
> and rush).

Well, considered as a proposed modern language, /bin/sh kinda blows.
/bin/rc is better. Something like bash 4.0 is pretty featureful, but
it has little unity.

> Apparently some fans of a scripting language are so
> enthralled by the respective language that they deem it desirable to
> extend that language's usage to all aspects of a shell / an operating
> system.  These things rarely come into existence (or fill a niche
> only)

OpenWrt is wandering that way with LuCI.

IMO on Unix if you want to play the part of a shell, the problem comes
down to embedding a reasonable domain-specific quasiquotation syntax
for constructing process invocation structures. Which would you rather
write?

  proc{'find', "/usr", "-name", pattern, "-print0"}.pipe{'xargs', '-0', 'du'}()

  find /usr -name "$pattern" -print0 | xargs -0 du

  find /usr -name $pattern -print0 | xargs -0 du

Note that the last is /bin/rc, and writing it that way (without
quotes) in /bin/sh is just asking for trouble.

A huge problem with /bin/sh is it's easy to write stuff that
completely falls over in the presence of unexpected characters.

Anyway, without some way of capturing lexicals in
little-language-strings, Lua is kinda stuck for using strings as
escape hatches to non-Lua syntax.