lua-users home
lua-l archive

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


On 10/2/18, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Jim once stated:
                                       ^^^^^^^ why are you trying to
ridicule me ?

>   Well, one could wrap those regex functions into a Lua module so it's
> available for you to use.
sure, that's what we will do.
how about directly using squirrel that has that already available ?

>   That's for Luis and Roberto to answer.  For me, I never needed to use
> octal, and I'm past the need for binary literals (I wouldn't mind them, but
> I'm not lamenting their lack).
we make heavy use of octal integer literals and that's absoluely nothing
very extraordinary or exotic in any way.

>   Why was Lua picked in the first place if you now regret it?  Is is the
> fact that Lua doesn't have real regex that makes it suck?  Or are there
> other factors that make you regret the choice of Lua?
we thougt it could be used as a scripting language, akin to perl, python, ruby
and all the others.

we failed to recognize that it was only designed for authors that use it as
a config language for their c program to avoid inventing one of their own.
Lua is obviously not designed to run scripts that do any real work.
it's just a toy, a study of how a config language could look, it's not made
for scripting like say perl or other scripting languages,
it simply was not made for this and thus obviously is not up for the task.
we thought having an interpreter around was for interpreting scripts as the
perl interpreter for instance does.

it's a really poor design that changes with every release because something
is broken again or poorly thought out.
for instance: how dumb and clueless must one be to release a language that
has only floating point arithmetic in a time were 386, 486SX and other cpus
without an fpu were in wide usage ?
we dont use any floating point arithmetic btw., integer is enough for us.
was Lua designed as a new fortran that could also be used as a config language ?
and now look how many decades (!!!!) it took until someone decided that
integer arithmetic and bitwise ops wasn't that bad.

now look at the regex module, it doesnt work with lua5.3, so we dont have
even a binding for posix regex (that would suffice for us, no need for PCRE),
so we have to implement our own.

have a look at lua rocks that uses a collection of unmaintained garbage
laying and rotting around for years abondoned by the authors since they
stopped using lua for obvious reasons.
that crap is not even usable on linux, and its a total mess on solaris.
imagine perl. python or anyone else would deliver such poor tooling ...

>   Is this the language described by squirrel-lang.org?
well, obvously, mr. genius, that's why i mentioned it.

> Because if so, the
> API seems very close to the Lua API (it downright seems Lua influenced the
> design from what I can tell).  What is it about the Lua C API that sucks?
> Or why is the squirrel one better?

squirrel was based on Lua, the author tried to fix some of the main problems.
a brief look on its api is not enough, read and compare it point by point with
lua's api, then use it in some code and you will understand what i am about.

>   Because from my brief look, they seem very similar.
from a brief look lua might also look like a scripting language, but a
brief look
is not enough. use the squirrel api and you will see what i mean.

>   In some respects yes.  In other respects no. On Linux you need to link
> with pthreads of you use that; not so on other systems.  On Solaris you
> need
> to link with nt if you want to use the network API (socket(), bind(),
> accept(), etc) but no so with other Unix systems.  On Windows, POSIX isn't
> part of the C library (although I could be wrong, but I would find it
> surprising).

#include <unistd.h>

static int Sgetuid ( lua_State * const L )
{
   /* getuid() always succeeds, as required by posix */
   lua_pushinteger ( L, getuid () ) ;
   return 1 ;
}

thats the same on linux, solaris, aix, all of the bsds, and even crap
like macos X.
same for geteuid(), get(g)id(), get(p)pid(), umask(), fork() to name
a few. how does that complicate anything, how exactly does that
bring in pthreads, i missed the point, could you make this more clear
and enlighten us a bit ?

>   I don't know which Unix you are using, but the ones I've had experience
> with never came with regex "for free" (as part of libc).
well posix requires regex to be found in <regex.h>, so every unix has
them, from aix to the bsds, its in the libc that one has to use anyway.
so its there for FREE on all relevant unix platforms.

>   There are Lua modules that provide such functionality but I'm guessing
and dont work for any recent lua version ? like the regex module ?
> you want those built into the base Lua distribution.
exactly.

> different priorities; if you agree with them, use Lua.  If you don't, don't
> use Lua.
exactly,.

i figured out recently that the ruby c api is quite usable by hand, though i
dont like ruby and its oo style that is forced on all its users very much.
advantage is that it is a scripting language not just a config lang,
and scripting is what we are doing.
so we started porting our c bindigs and helper functions to ruby as an
interim workaround, buts thats not the end solution.

in the meantime we had a look at several script languages with a usable
c api, from older ones like forth (fth), (regina) rexx, tcl, to java script
implementations like duktape and mujs to newer inventions like ring-lang.net
but so far we have not found anything that pleases us and in the long run
we will have to implement our own solution as no existing tool is up to the
task (at least we did not found one).

that was exactly what we tried to avoid as we were not interested in
inventing the next extension lang (that only we and no one else will use)
and reinvent the wheel.