So, I can't help wonder how Tcl compares to Lua.
Does anyone here know Lua? I'm sure each has their strengths and
weaknesses. I'm only interested in what are Tcl's advantages over Lua.
Lisa
Tcl constitutes a far richer programming environment.
Lua is more minimal in its run-time impact.
Tcl supports Unicode and regular expressions more fully
than Lua.
Tcl has Starpacks, stubs, and so on.
Tcl/Tk is ahead of TkLua.
There are more Tcl books.
Some prefer EIAS to the impressive mileage Lua gets out
of dictionary-based metaprogramming.
Lua's a wonderful language. It also remains a niche
language. Tcl comes much closer to universality.
EIAS?
Indeed, strictly speaking Lua doesn't have regular expressions at all.
It has pattern matching with some wildcards and character classes but
it lacks both alternation (e.g. cat|dog) and closure of subexpressions
(e.g. (ab)*).
Some things can be made to work in UTF-8 since Lua is 8-bit clean but
the short answer regarding Unicode support is that it doesn't. There is
a library that provides alternative string functions that work with
UTF-8. If you need to do a wee bit of Unicode you can probably make it
work but Lua is not designed to make Unicode easy. For details see:
http://lua-users.org/wiki/LuaUnicode.
<URL: http://wiki.tcl.tk/14086 >
The famous mantra: Everything Is A String
The way I heard about Lua was when I was looking for a "Setup Wizard" type
program to create installers for my own software, like Install Shield, Wise,
etc. I came across one that featured embedded "Lua scripting" to do install
operations.
But wouldn't TCL be much more suitable for this? I sure thing so.
It seems Lua's strengths is smaller footprint and better performance than
TCL. And they said it runs on mobile devices too. TCL is too slow for mobile
devices, I was told on here.
Lua also seems to allow easy integration with C/C++ and extensible.. how is
this different from a tcl 'stub' ?
One thing that appeals a bit to me about Lua, is that it comes with a
'compiler' that turns script code into bytecode. No such free meal with TCL
(though I heard ActiveState has a commercial solution).
Lisa
"Cameron Laird" <cla...@lairds.us> wrote in message
news:7g4d83-...@lairds.us...
Lua's popular with gamers 'cause of the small memory footprint, good
performance, and absence of $-s in its syntax. Also, it's as easy to
interface to C-coded modules as any practical high-level languages,
and easier than nearly all.
I wouldn't say that since knowledge is often its own benefit. I took a
peek and found Lua's concept of "tables" particularly interesting. It's
like Tcl's list+array as well as C/C++ struct. Structs is the one thing
I miss in Tcl.
> They say it's used a lot for "Games programming".
So is Tcl, for exactly the same reason. Though Lua have slowly been
replacing Tcl. I suspect it's because it's smaller, uses infix notation
and doesn't use $ to handle variables (making C programmers more
comfortable with it).
> Doesn't cross platform usually means it can't take advantage of hardware specifics?
No, it only means it is clean C (or ANSI C, or POSIX) code without
platform dependencies. Taking advantage of hardware specifics is the
job of your C compiler.
> The way I heard about Lua was when I was looking for a "Setup Wizard" type
> program to create installers for my own software, like Install Shield, Wise,
> etc. I came across one that featured embedded "Lua scripting" to do install
> operations.
> But wouldn't TCL be much more suitable for this? I sure thing so.
>
I'd think Tcl would be perfect for this since this sort of stuff
involves a lot of text processing.
> It seems Lua's strengths is smaller footprint and better performance than
> TCL. And they said it runs on mobile devices too. TCL is too slow for mobile
> devices, I was told on here.
>
Tcl runs fine on mobile devices - better than Java IMHO since Tcl uses
less RAM. The Tcl interpreter is usually the first interpreter to be
ported on small platforms. But since Lua is so small, I suspect it uses
even less resource than Tcl. But saying Tcl is slow for mobile devices
is just plain wrong since the same mobile devices are usually designed
to run Java.
Everything Is A String, which is the fundamental basis of Tcl's semantic
model (stretching back to, oh, the very beginning!) Since 8.0 that's
been modified a little bit (to "Everything Looks and Works Like A
String") but that's close enough that it's not worth changing the acronym.
What does EIAS mean? It means that every value must be representable in
a printable way, and every value must be creatable from a string. For
simple things (like an integer or a list) it's pretty obvious how that's
done, but other cases (especially relating to some extensions) are much
harder.
Donal.
> Thank you.. This was very helpful.. it tells me I shouldn't bother with
> Lua, .. or do I?
> They say it's used a lot for "Games programming". What makes it suitable
> for games programming, other than it's cross platform features? Doesn't
> cross platform usually means it can't take advantage of hardware
> specifics?
>
I suspect SDL is used a lot more for games programming and I think you will
find a Tcl extension that supports it on the wiki.
Ian
Yes, take a look at: http://www.installjammer.com/
Lua does seem to be quite popular in the gaming world - though not
usually for writing the actual game, but for providing it's scriptable
components. Many modern games are scriptable in one form or another,
and many developers are now choosing to use an off-the-shelf scripting
solution rather than trying to develop one specifically for their game
(which adds to development time and cost, and ultimately - time to
market). When that's the situation, Lua does seem very popular. I
don't know enough about it to say for sure, but I suspect its
popularity in that arena is related to it's size, speed, and
simplicity.
Jeff
Please point me to the person who told you that, "TCL is too
slow for mobile devices". As it stands, that's simply not
true.
slebetman, do you truly believe that Tcl is inappropriate for
construction of installers because Tcl makes "text processing"
too difficult? That doesn't make sense to me--particularly
not with the evidence of <URL: http://wiki.tcl.tk/1896 >.
Lua is definitely smaller than Tcl. It achieves this by leaving out lots
of stuff, so much so that Lua is a language that is only usable in
practice after extension (I think it doesn't have a full I/O system, for
example). By contrast, you can do a lot in plain tclsh without binary
packages, and many people do just that.
What'll be interesting is to see if Lua grows over time like Tcl did.
And if it does, what mistakes in the provided libraries do the Lua
developers make. (If it doesn't grow, it'll remain a niche language,
used in embedded situations where the programmer hasn't heard of Forth.)
Donal.
Stubs is in part an attitude to backward compatability that is oriented
to very stable APIs and heavy production use. Actually stubbing an API
isn't very hard; you use automated tools to do most of the maintenance
after all. But keeping those promises you made by adopting a stubbed
API, well, that's a different story altogether.
FWIW, most commercial software is nothing like as stable as Tcl, even if
we restrict ourselves to examining just the API (and leave out things
like propensity to crash, etc.) To see what I mean by this, you have to
realize that code that was compiled to binary form against Tcl 8.1 (i.e.
perhaps as far back as May 1999) will still probably work if loaded into
the CVS HEAD version of 8.5, over six and a half years later. (Of
course, if we talk about source compatability, I've got code that was
written against Tcl 7.4 which still builds now, over a decade later.)
Donal.
Cameron Laird wrote:
> In article <1135902376.7...@g44g2000cwa.googlegroups.com>,
> sleb...@yahoo.com <sleb...@gmail.com> wrote:
> >> It seems Lua's strengths is smaller footprint and better performance than
> >> TCL. And they said it runs on mobile devices too. TCL is too slow for mobile
> >> devices, I was told on here.
> > <snip>
> >even less resource than Tcl. But saying Tcl is slow for mobile devices
> >is just plain wrong since the same mobile devices are usually designed
> >to run Java.
> >
>
> Please point me to the person who told you that, "TCL is too
> slow for mobile devices".
Lisa Pearlson.
> As it stands, that's simply not true.
I also said that it is not true.
> >I'd think Tcl would be perfect for this since this sort of stuff
> >involves a lot of text processing.
>
> slebetman, do you truly believe that Tcl is inappropriate for
> construction of installers because Tcl makes "text processing"
> too difficult?
I don't see how you can interpret the phrase "Tcl would be perfect" to
mean "Tcl is inappropriate". So let me rephrase what I said by
paraphrasing you: Tcl is inappropriate for construction of installers
because Tcl makes "text processing" easy.
> That doesn't make sense to me--particularly not with the evidence of
> <URL: http://wiki.tcl.tk/1896 >.
Doesn't make sense to me too since Lua is not as 'EIAS' as Tcl.
Heh.. sorry, the problem with paraphrasing is that sometimes you
paraphrase too much or too little. What I meant to say was:
Tcl is appropriate for construction of installers because Tcl makes
"text processing" easy.
(delete the 'in' in 'inappropriate')
>>Please point me to the person who told you that, "TCL is too
>>slow for mobile devices".
> Lisa Pearlson.
>>As it stands, that's simply not true.
> I also said that it is not true.
In case you hadn't seen it, I wrote a sort of small cousin to Tcl called
Hecl that runs in J2ME environments:
It's not a speed demon, but it's a very dynamic scripting language
written on top of Java, and it's still usable on my relatively low-end
Nokia 3100. If you have an environment where Tcl itself runs, it's fast
enough for a whole lot of things. Where it isn't, most other scripting
languages aren't likely to be either, and if you want to be *fast*, you
want to rewrite that code in C in any case - something that Tcl lets you
do with relative ease.
--
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/