Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130825224039.62330f52@x34f>
Date: Sun, 25 Aug 2013 22:40:39 +0300
From: Paul Sokolovsky <pmiscml@...il.com>
To: Rob Landley <rob@...dley.net>
Cc: musl@...ts.openwall.com
Subject: Re: Squirrel - no-bloat scripting language with sane syntax
 and semantics

Hello,

On Sun, 25 Aug 2013 04:34:33 -0500
Rob Landley <rob@...dley.net> wrote:

> On 08/23/2013 04:11:18 PM, Paul Sokolovsky wrote:
> > Hello,
> > 
> > I apologize if this message can be considered off-topic. However, my
> > reading thru mailing list archive showed that there's favorable
> > attitude to generic no-bloat stuff, so I hope this message may be of
> > interest to some readers.
> 
> We have a list of random packages in the musl wiki, but I stopped  
> paying attention to it when people started adding GNU projects to it.
> I don't understand what it's for at that point.

Yeah, like you shared sentiment that there should be site for embedded
beginners, apparently lot of people feel that there should be
community-driven (vs personal orthodoxy) site for unbloated software,
and took that musl page as a lure ;-).

> > I'd like to draw attention to small very high level (meaning that
> > there's native support for lists and maps) language "Squirrel",
> > http://squirrel-lang.org/ . It compiles below 300K (dynamic linking)
> > with -O2 and can be gotten under 200K with -Os -flto (sizes are for
> > i386). It uses C-like syntax, so should be a quick start for many  
> > folks.
> 
> Normally people use lua for this, which has around 100k of
> interpreter.

Surely they use lua out of desperation and lack of alternatives? (Like,
maybe if they knew about Brainfuck, they'd use it instead?) As for the
code size, Squirrel can be slimmed down. For example, default config
includes garbage collector - it's not used by VM, which uses strictly
reference counting for more predictable timing, but user can call GC at
suitable times either to debug cycles, or just clean cruft if they
don't feel like using weakrefs. For well-behaving app, VM can be built
without GC and without bytecode compiler.

> 
> The downside of lua is it doesn't have a full standard posix C
> binding library. 

Lua, just as Squirrel, are embedable languages and by definition don't
need any "standard library bindings", it itself is bound to an app. Out
of desperation for unbloated solution, people wrote lot of modules for
Lua to make it a standalone general-purpose language, which exposed lot
of issues in Lua semantics, which weren't critical for original embedded
usage in games, but are pretty critical for a gen-purp language.

> (It has a nonstandard one you can add on, but when I
> looked at writing a busybox clone in it, I needed to install
> something like 7 packages to get all the libraries I needed. Then
> again, most people aren't implementing their own "ifconfig", "mount",
> and "taskset"...)

Installing 7 (small) packages is the way to go for unbloated language,
otherwise it all will end up like Python - its vast, user-friendly,
all-encompassing library is also its curse when it comes to embedded
usage.

> I note that lua is heavily used in the gaming industry, half of
> World of Warcraft is written in it, for example.

Poor fellas, I agree.

> 
> > The language was created in 2003, and now at 3.0.4, but it's mostly
> > one-man project, and the maintainer is not interested in its usage
> > beyond "embed in C/C++ application" pattern.
> 
> So he's been doing it for 10 years and nobody's heard about it.

Everybody heard about busybox, nobody heard about toybox, go
fight that, Rob ;-). Besides, as was pointed out, the gaming industry
is well aware of it and even risked using it in few high-profile (as
they say, I don't play ;-( ) projects - that's in the industry which is
just condemned to use Lua.

But what you say is exactly the problem - the author, Alberto
Demichelis appear to be pretty satisfied with this niche role. Which is
all understood, because there're so many general-purpose language that
fighting against them is futile. Just the same as there's already
uclibc, busybox, gcc and even llvm, and buildroot has been building
your embedded distro for ages - well, you got the idea...

> 
> > After some poking around
> > for alternative small scripting languages and even considering
> > writing web apps in C++, I gave up and decided to take solution of
> > the "last mile" problem myself - to turn it into standalone
> > general-purpose language, so it was suitable for arbitrary
> > applications and wide audience (which means resolving few warts the
> > original language does have).
> 
> Back in the Fidonet days I downloaded a list of 2500 programming  
> languages. The vast majority of them were one person projects, often  
> some graduate student who did it as a class project.
> 
> (Heck, I wrote one myself back in 1991 when I was first getting into
> C. I did a bytecode interpreter with an assembler for the bytecode;
> didn't have a libc because the interpreter had bytecodes for things
> like "open file".)

Every schoolboy writes his own language. Very few write *high-level*
language, and almost none debug all the memory issues with it. That's
why I figured it's nice idea not to write my own language, and take
core from the guy who debugged it fro 10 years...

> > What I have done so far is at
> > https://github.com/pfalcon/squirrel-modules and
> > https://github.com/pfalcon/squirrel-lang/tree/squirrel3-pfalcon .
> > So, if you ever dreams of sane unbloated scripting language,
> 
> It's called lua. (Ken Thompson has similar dreams for go, but I'm
> not convinced.)

Rob, you may be missing with Lua just like Ken ;-).

> 
> > please give it
> > a try. And of course, I couldn't lead it to general-purposed'ness
> > myself, so if you find the idea neat, please consider joining the
> > effort ;-).
> 
> Python is now at least two incompatible languages. I've seen  
> applications implemented in standalone PHP, games written in Ruby,
> more than one attempt to come up with an embedded subset of perl, at
> least three special purpose lithp engines, javascript used outside
> the browser _or_ server, more languages repurposing Java's Virtual
> Machine than I can track, people still doing new stuff in tcl for
> some reason, my ubuntu install has Haskell presumably because of some
> dependency, OpenFirmware is implemented in fourth so that's still
> around...

My criteria for selecting Squirrel was simple and clear: sanity and
syntax familiarity as invariants, enough maturity, then minimal size.
Know better alternatives? But otherwise, you're right - in the world
where JavaScript curse broke out of browsers and threatens to drown
entire IT in itself, one can't be shy to do things which he thinks are
right ;-).

> 
> I note that this is off the top of my head. (I'm off in a corner of
> the university out of the range of wireless signal, replying into my
> outbox queue.)
> 
> > Example no-nonsense script written in (general-purpose) Squirrel:
> 
> There was a fun gallery of decss implementations written in various  
> languages a decade and change ago. I vaguely recall he had a couple  
> hundred, although a lot of those were things like cobol and pascal
> and fortran and visual basic that we can only _hope_ are dead now...

I share the sentiment - we barely finished funeral for Perl (hurrah),
like other roobie-javascreeptie-looa plague spreads around...

Kinda more modern variant of such shootout is
http://rigaux.org/language-study/scripting-language/ . Still pretty
subjective IMHO, who said that *scripting* language should munge files
like sh? Somebody should do better...

> 
> Rob


P.S. Yeah, this gets pretty offtopic...

-- 
Best regards,
 Paul                          mailto:pmiscml@...il.com

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.