News for hackers. Stuff that matters.
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by jacques_chester on Sunday October 17, 2010 @12:30AM (#1799664)
> Am I just missing some information in this regard?

A major, and non-negotiable, design goal of Lua is that it targets the ANSI C environment to maximise portability. ANSI C does not define Unicode support.

Incidentally, those two libraries might be unchanged because they're stable. The rate of change in the main lua implementation is quite measured.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @12:44AM (#1799687)
More specifically, Unicode is one of those things (like bignum support) where Lua's design for embedding assumes that if it's a priority, your project will already have settled on a library for it, so anything Lua came bundled with would just get in the way. The GMP library, for example, is almost four times larger than the whole Lua runtime.

Besides, Lua strings are interned raw byte-arrays (like atoms in Erlang or Lisp atoms), and can have \0s and other arbitrary binary data. While the standard string library is ignorant of Unicode, there's nothing preventing extra libraries from providing Unicode-aware string operations.

Lua also left out native regular expression support, because it would be larger than the rest of the standard libraries put together. You can just load LPEG if it matters.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by indigoviolet on Sunday October 17, 2010 @01:38AM (#1799766)
I wouldn't have a problem with external unicode support if there was one "standard" recommended library that had a strong community behind it. My whole point is that that doesn't appear to exist.
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @01:49AM (#1799780)
Sure. This is a real issue for new Lua users, though in the long run it's not a showstopper.

For roughly half the people using Lua, library choices have already been decided by the big C++ (or whatever) project they're adding Lua to, so the question never arises in the first place. That's the primary use case for Lua. It's a really nice standalone language, too, but it was designed for embedding. Many of its strengths (such as the small, orthogonal, clean design) come from that focus, but so do some quirks. If you use Lua as a standalone language, you'll occasionally need to do some digging for libraries, particularly if you're not comfortable with C. The situation has been improving significantly over the last year or two, though.

I don't have a specific Unicode library recommendation, but would suggest checking the mailing list archives (http://lua-users.org/lists/lua-l/).

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by kylecordes on Sunday October 17, 2010 @12:37AM (#1799673)
(I'm the guy in the video.)

I haven't had a need for Unicode in Lua, but when I stumbled across some information about it, the essential story was that there is nothing stopping you from writing code to manipulate Unicode data (obviously), but there is also nothing built in to help you. All the built in string stuff is ANSI/ASCII/whatever.

However, the language Io (which often gets mentioned in the same breath as Lua, though it's quite different in some ways) has a stronger Unicode story: http://www.iolanguage.com/scm/io/docs/IoGuide.html#Unicode

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by metamemetics on Sunday October 17, 2010 @04:11AM (#1799901)
Are you affiliated with Lambda Lounge in STL?
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by kylecordes on Sunday October 17, 2010 @07:37AM (#1800128)
Yes! I know the guy who started Lambda Lounge (Alex Miller http://tech.puredanger.com/about ) and heartily supported its founding; I spoke at it every once in a while; and my firm (Oasis Digital http://oasisdigital.com/ ) sponsors Lambda Lounge by paying for travel expenses for out-of-town speakers.

Lambda Lounge is the best software dev user group ever.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by puredanger on Sunday October 17, 2010 @09:18AM (#1800235)
I'm Alex Miller, the founder of Lambda Lounge. If you want to drop me a line email me at

contact at puredanger.com

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by benatkin on Sunday October 17, 2010 @12:42AM (#1799681)
The Lua philosophy is far different from the philosophy of other languages. That's why videos like these, that cover the advantages before the tradeoffs, are a good thing. Knowing the positive things about something really effects my perceptions of the tradeoffs.

Also, Unicode is an odd thing to consider to be an essential part of a programming language. Usually when I hear it I think the person must think it's a part of accepting those that speak other languages. I would point out the fact that Ruby took much longer to get Unicode support than Python as a counterpoint to that, as Ruby's creator, Matz, is Japanese.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by arkx on Sunday October 17, 2010 @12:58AM (#1799708)
As a Finnish software dev I can say that in these days native support for Unicode is a must. We have a couple of special characters in the alphabet (åäö) and if you have to do a lot of manual work to use these, the programming language is pretty much unusable for real world stuff that involves any use of Finnish.

The fact that Ruby took so long to get real Unicode support is due to Japanese resisting Unicode in favor of their own encodings, EUC-JP and Shift JIS, just like Finnish used to cling to ISO-8859-1(5) for so long.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @01:36AM (#1799763)
Is Unicode something that needs to be in the core of a language, or is it sufficient to leave it to libraries, if the language's design doesn't prevent it?

On this computer (OpenBSD/i386), icu has over 1 MB of libraries and a 15 MB data file. The whole Lua distribution fits in one 200k library. Bloating the core language with that seems impractical.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by arkx on Sunday October 17, 2010 @02:46AM (#1799824)
In my opinion, it needs to be in the core.

Imagine you need to go through a library every time your string includes or might include the letter "s" or "v". Basically you'd need to use this library for all your strings. But then you lose compatibility with 'normal' string type and need to be constantly aware of the difference. You might want to use some other library that doesn't support this Unicode library at all, etc. It quickly becomes a very painful world to live in.

As you might imagine, just having support for Unicode baked in the language is very nice. Defaulting to Unicode for all text is even better.

I can understand why Lua in particular doesn't come with Unicode support out of the box, being so small. My comment was written in response to the more general claim that Unicode support is a strange thing to consider essential in a programming language.

(According to http://www.bckelk.ukfsn.org/words/etaoin.html, s/ä and v/ö are comparable in frequency.)

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @11:21AM (#1800510)
I think we have slightly different ideas about the language core vs. library distinction. In C, for example, printf and strlen are library functions (stdio.h and string.h), while structs are part of the core language.

All the language core needs for Unicode is reasonable support for tagging string literals (i.e., U"blah") and a binary-safe string type. It's best if there's either a standard or de facto community standard library for doing Unicode string ops, but it doesn't need core support anymore than the Linux kernel needs to know about parsing HTTP.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by stcredzero on Sunday October 17, 2010 @09:16AM (#1800232)
Is Unicode something that needs to be in the core of a language, or is it sufficient to leave it to libraries, if the language's design doesn't prevent it?

At the very least, there should be a first-class type that maps 1-to-1 with a Unicode CodePoint. Then there should be easy ways to do common operations on strings in terms of CodePoints. (Like string comparison, substring matching, concatenation.) Furthermore, the encodings should be handled in a transparent way.

If the goal is to keep Lua to a 200k core, then there should be a mechanism to add such functionality as if it's built in.

EDIT: "transparent" meaning, it looks like core functionality.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @10:01AM (#1800318)
> If the goal is to keep Lua to a 200k core, then there should be a mechanism to add such functionality as if it's built in.

There is. See "metatables" - the behavior of tables (Lua dicts) and userdata (handles to C pointers, or raw C pointers) is intentionally left minimal but extensible, so that new first-class ("transparent") types can be added.

For example, Lua doesn't have full regexp support* , but there's LPEG (http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html), a library that adds a PEG-based matching/parsing engine (which is a superset of REs). It's no less usable for being in a library rather than the core.

* Though what it does have (http://www.lua.org/manual/5.1/manual.html#5.4) if often good enough - the main thing missing is groups, e.g. "a+(ab|bc)?d".

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by xtho on Sunday October 17, 2010 @02:23AM (#1799806)
The characters you listed are defined in latin-1. They really don't serve as a good example for the urgent need to use unicode.
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by arkx on Sunday October 17, 2010 @02:52AM (#1799830)
They are not in ASCII, and that is the problem. You wouldn't believe how many times I've tripped over Python 2.x's UnicodeDecodeError for example.

Moreover, I wasn't searching for the best example -- merely using something I have personal experience of.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by jacques_chester on Sunday October 17, 2010 @12:49AM (#1799696)
> Also, Unicode is an odd thing to consider to be an essential part of a programming language.

It really depends on what the language is used for. Web-facing applications are, in general, going to received unicode input, so for them it matters. But for an embedded programmer, for example, it might be utterly irrelevant.

Horses for courses, really. It just so happens that Lua has other properties that are very attractive to web apps too, which the presentation outlined.

-- and yes, still alive and commenting :P

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by riffraff on Sunday October 17, 2010 @07:29AM (#1800117)
but ruby supported different encodings from the start, such as shift_jis, utf8 and euc_jp, it's just that the support was not "good enough". The reason why it took so long to have an improved one is also to be searched in the will of core ruby devs to support something better than only unicode.
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by indigoviolet on Sunday October 17, 2010 @01:30AM (#1799751)
slnunicode hasn't changed or been updated, and has no forum posts or bugs since 2006 [http://luaforge.net/projects/sln/]

ICU4Lua hasn't been touched since April 2009, and is at 0.2B. [http://luaforge.net/projects/icu-lua/]

That sort of status just doesn't inspire confidence in a language. I understand you can use it for game programming, or that you can write your own libraries for it, but that sort of thing doesn't encourage adoption.

Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @01:33AM (#1799758)
ICU4Lua is a wrapper for an existing, stable library. Does (for example) the Python wrapper for sqlite get a lot of commits these days? And if not, does that make it dead and abandoned?
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by indigoviolet on Sunday October 17, 2010 @01:37AM (#1799764)
Why is it in beta? Why does the mailing list [http://lists.luaforge.net/pipermail/icu-lua-users/] have no activity on it?
Re:Lua Doesn't Suck – Strange Loop 2010 20-minute talk video by silentbicycle on Sunday October 17, 2010 @01:39AM (#1799767)
Unless something is a major standalone project, discussion usually happens on the main Lua mailing list instead. About the beta label - I don't know. gmail was in beta for a long time, too, though.